Compare commits
4 Commits
8349132d66
...
200cb8b026
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
200cb8b026 | ||
|
|
b7ad1d391f | ||
|
|
0e1b8581af | ||
|
|
21adf4a3dc |
24
flake.lock
generated
24
flake.lock
generated
@@ -303,7 +303,8 @@
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pppdotpm-site": "pppdotpm-site",
|
||||
"whib-backend": "whib-backend"
|
||||
"whib-backend": "whib-backend",
|
||||
"whib-frontend": "whib-frontend"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
@@ -356,6 +357,27 @@
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.ppp.pm:1122/alex/whib.git"
|
||||
}
|
||||
},
|
||||
"whib-frontend": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1761488530,
|
||||
"narHash": "sha256-ooXnvS3ffmqZ91Gl81CZzCj65rdAjVEc8oR/9CsGZ2Y=",
|
||||
"ref": "master",
|
||||
"rev": "95bb44fae3187e5d8c007e80fa30addffe154544",
|
||||
"revCount": 221,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.ppp.pm:1122/alex/whib-react.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "master",
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.ppp.pm:1122/alex/whib-react.git"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib.git?ref=master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
whib-frontend = {
|
||||
url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib-react.git?ref=master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
@@ -105,6 +110,7 @@
|
||||
./hosts/tadpole/configuration.nix
|
||||
./hosts/tadpole/home.nix
|
||||
inputs.whib-backend.nixosModules.${system}.default
|
||||
inputs.whib-frontend.nixosModules.${system}.default
|
||||
];
|
||||
};
|
||||
|
||||
@@ -120,6 +126,7 @@
|
||||
modules = [
|
||||
./hosts/test-vm/configuration.nix
|
||||
inputs.whib-backend.nixosModules.${system}.default
|
||||
inputs.whib-frontend.nixosModules.${system}.default
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
group = "nginx";
|
||||
};
|
||||
|
||||
"whib.ppp.pm" = {
|
||||
webroot = "/var/lib/acme/acme-challenge/";
|
||||
group = "nginx";
|
||||
};
|
||||
|
||||
"api.whib.ppp.pm" = {
|
||||
webroot = "/var/lib/acme/acme-challenge/";
|
||||
group = "nginx";
|
||||
|
||||
@@ -23,6 +23,7 @@ in
|
||||
|
||||
pppdotpm-site.enable = true;
|
||||
whib-backend.enable = true;
|
||||
whib-frontend.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,24 +4,30 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
enabled = config.mod.whib-backend.enable;
|
||||
backendEnabled = config.mod.whib-backend.enable;
|
||||
frontendEnabled = config.mod.whib-frontend.enable;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
mod.whib-backend = {
|
||||
enable = lib.mkEnableOption "enable WHIB backend";
|
||||
};
|
||||
|
||||
mod.whib-frontend = {
|
||||
enable = lib.mkEnableOption "enable WHIB frontend";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf enabled {
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.nginx.enable;
|
||||
assertion = backendEnabled && config.services.nginx.enable;
|
||||
message = "Option 'config.services.nginx' must be enabled";
|
||||
}
|
||||
];
|
||||
|
||||
services.whib-backend = {
|
||||
services = {
|
||||
whib-backend = lib.mkIf backendEnabled {
|
||||
enable = true;
|
||||
|
||||
backend = {
|
||||
@@ -50,6 +56,15 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
whib-frontend = lib.mkIf frontendEnabled {
|
||||
enable = true;
|
||||
|
||||
domain = "whib.ppp.pm";
|
||||
useACMEHost = "whib.ppp.pm";
|
||||
backendHost = "https://api.whib.ppp.pm";
|
||||
};
|
||||
};
|
||||
|
||||
age.secrets = {
|
||||
"whib-backend-env-vars".file = ../../../../secrets/tadpole/whib-backend-env-vars.age;
|
||||
"whib-postgres-env-vars".file = ../../../../secrets/tadpole/whib-postgres-env-vars.age;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
imports = [
|
||||
./ppp.pm-site.nix
|
||||
./whib-backend.nix
|
||||
./whib-frontend.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
@@ -13,6 +14,7 @@
|
||||
mod = {
|
||||
pppdotpm-site.enable = false;
|
||||
whib-backend.enable = true;
|
||||
whib-frontend.enable = true;
|
||||
};
|
||||
|
||||
users.users.a = {
|
||||
|
||||
34
hosts/test-vm/whib-frontend.nix
Normal file
34
hosts/test-vm/whib-frontend.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
enabled = config.mod.whib-frontend.enable;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
mod.whib-frontend = {
|
||||
enable = lib.mkEnableOption "enable WHIB backend";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf enabled {
|
||||
services.whib-frontend = {
|
||||
enable = true;
|
||||
|
||||
domain = "whib-frontend.local";
|
||||
port = "8081";
|
||||
backendHost = "https://api.whib.ppp.pm/"; # "whib-backend.local";
|
||||
};
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
forwardPorts = [
|
||||
{
|
||||
# Service API
|
||||
from = "host";
|
||||
host.port = 8081;
|
||||
guest.port = 8081;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user