modules: add actual, nqptp, and voidauth service modules
This commit is contained in:
50
modules/services/voidauth.nix
Normal file
50
modules/services/voidauth.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.voidauth;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
port = cfg.settings.APP_PORT or 3000;
|
||||
in
|
||||
{
|
||||
options.services.voidauth = {
|
||||
subdomain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
inputs.voidauth.nixosModules.voidauth
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
voidauth = {
|
||||
settings = {
|
||||
APP_URL = "https://${fqdn}";
|
||||
DB_SOCKET_PATH = "/run/postgresql";
|
||||
DB_NAME = "voidauth";
|
||||
};
|
||||
};
|
||||
|
||||
webserver = {
|
||||
enable = lib.mkDefault true;
|
||||
vHosts.${fqdn}.locations."/".proxyPort = port;
|
||||
};
|
||||
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ "voidauth" ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "voidauth";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user