diff options
Diffstat (limited to '')
-rw-r--r-- | modules/nixos/gotify.nix | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/modules/nixos/gotify.nix b/modules/nixos/gotify.nix index 4bdd4fa..ad9b277 100644 --- a/modules/nixos/gotify.nix +++ b/modules/nixos/gotify.nix @@ -4,9 +4,11 @@ libNginx, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.gotify; -in { +in +{ options.nixfiles.modules.gotify = { enable = mkEnableOption "Gotify"; @@ -17,14 +19,15 @@ in { }; }; - config = let - db = "gotify"; - in + config = + let + db = "gotify"; + in mkIf cfg.enable { nixfiles.modules = { nginx = { enable = true; - upstreams.gotify.servers."127.0.0.1:${toString config.services.gotify.port}" = {}; + upstreams.gotify.servers."127.0.0.1:${toString config.services.gotify.port}" = { }; virtualHosts.${cfg.domain} = { locations."/" = { proxyPass = "http://gotify"; @@ -50,7 +53,7 @@ in { }; postgresql = { - ensureDatabases = [db]; + ensureDatabases = [ db ]; ensureUsers = [ { name = db; @@ -61,7 +64,10 @@ in { }; systemd.services.gotify-server = { - after = ["network-online.target" "postgresql.service"]; + after = [ + "network-online.target" + "postgresql.service" + ]; environment = { GOTIFY_DATABASE_DIALECT = "postgres"; GOTIFY_DATABASE_CONNECTION = concatStringsSep " " [ |