diff --git a/common/server/default.nix b/common/server/default.nix index a7c20cf..4dec0ea 100644 --- a/common/server/default.nix +++ b/common/server/default.nix @@ -16,5 +16,6 @@ ./librechat.nix ./actualbudget.nix ./unifi.nix + ./ntfy.nix ]; } diff --git a/common/server/ntfy.nix b/common/server/ntfy.nix new file mode 100644 index 0000000..e583d03 --- /dev/null +++ b/common/server/ntfy.nix @@ -0,0 +1,38 @@ +{ lib, config, ... }: + +let + cfg = config.services.ntfy-sh; +in +{ + options.services.ntfy-sh = { + hostname = lib.mkOption { + type = lib.types.str; + example = "ntfy.example.com"; + }; + }; + + config = lib.mkIf cfg.enable { + services.ntfy-sh.settings = { + base-url = "https://${cfg.hostname}"; + listen-http = "127.0.0.1:2586"; + auth-default-access = "deny-all"; + behind-proxy = true; + enable-login = true; + }; + + # backups + backup.group."ntfy".paths = [ + "/var/lib/ntfy-sh" + ]; + + services.nginx.enable = true; + services.nginx.virtualHosts.${cfg.hostname} = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:2586"; + proxyWebsockets = true; + }; + }; + }; +} diff --git a/machines/ponyo/default.nix b/machines/ponyo/default.nix index e79dad7..729ac9d 100644 --- a/machines/ponyo/default.nix +++ b/machines/ponyo/default.nix @@ -108,4 +108,8 @@ # librechat services.librechat-container.enable = true; services.librechat-container.host = "chat.neet.dev"; + + # push notifications + services.ntfy-sh.enable = true; + services.ntfy-sh.hostname = "ntfy.neet.dev"; }