diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
commit | e6ed60548397627bf10f561f9438201dbba0a36e (patch) | |
tree | f9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/nixos/gotify.nix | |
parent | 2024-04-18 (diff) |
2024-04-21
Diffstat (limited to 'modules/nixos/gotify.nix')
-rw-r--r-- | modules/nixos/gotify.nix | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/modules/nixos/gotify.nix b/modules/nixos/gotify.nix deleted file mode 100644 index ad9b277..0000000 --- a/modules/nixos/gotify.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ - config, - lib, - libNginx, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.gotify; -in -{ - options.nixfiles.modules.gotify = { - enable = mkEnableOption "Gotify"; - - domain = mkOption { - description = "Domain name sans protocol scheme."; - type = with types; str; - default = "gotify.${config.networking.domain}"; - }; - }; - - 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}" = { }; - virtualHosts.${cfg.domain} = { - locations."/" = { - proxyPass = "http://gotify"; - proxyWebsockets = true; - }; - extraConfig = libNginx.config.internalOnly; - }; - }; - postgresql = { - enable = true; - extraPostStart = [ - '' - $PSQL "${db}" -tAc 'GRANT ALL ON SCHEMA "public" TO "${db}"' - '' - ]; - }; - }; - - services = { - gotify = { - enable = true; - port = 7665; - }; - - postgresql = { - ensureDatabases = [ db ]; - ensureUsers = [ - { - name = db; - ensureDBOwnership = true; - } - ]; - }; - }; - - systemd.services.gotify-server = { - after = [ - "network-online.target" - "postgresql.service" - ]; - environment = { - GOTIFY_DATABASE_DIALECT = "postgres"; - GOTIFY_DATABASE_CONNECTION = concatStringsSep " " [ - "host=/run/postgresql" - "user=${db}" - "dbname=${db}" - "sslmode=disable" - ]; - }; - }; - }; -} |