extract ntfy configuration to push-notifications role
2 files changed, 29 insertions(+), 20 deletions(-)
M system/hosts/linde.nix → system/hosts/linde.nix
@@ -37,6 +37,7 @@ ../roles/binary-cache.nix ../roles/forgejo-runner.nix ../roles/goatcounter.nix ../roles/mailer.nix + ../roles/push-notifications.nix ../roles/readeck.nix ../roles/searchix.nix ../roles/sso.nix@@ -45,7 +46,6 @@ ../settings/services/git-server.nix ]; age.secrets = { redis-website.file = ../../secrets/redis-website.age; - ntfy.file = ../../secrets/ntfy.age; }; boot.loader.efi.efiSysMountPoint = "/boot/efi";@@ -355,11 +355,6 @@ extraConfig = '' redir https://{labels.2}.${domain}{uri} ''; }; - "ntfy.${domain}" = { - extraConfig = '' - reverse_proxy ${config.services.ntfy-sh.settings.listen-http} - ''; - }; }; }; networking.nat = {@@ -389,18 +384,4 @@ }; }; }; }; - - services.ntfy-sh = { - enable = true; - settings = { - base-url = "https://ntfy.alin.ovh"; - behind-proxy = true; - upstream-base-url = "https://ntfy.sh"; - auth-default-access = "deny"; - enable-login = true; - require-login = true; - }; - environmentFile = config.age.secrets.ntfy.path; - }; - }
A system/roles/push-notifications.nix
@@ -0,0 +1,28 @@ +{ + config, + ... +}: +{ + age.secrets.ntfy.file = ../../secrets/ntfy.age; + + services.ntfy-sh = { + enable = true; + settings = { + base-url = "https://ntfy.alin.ovh"; + behind-proxy = true; + upstream-base-url = "https://ntfy.sh"; + auth-default-access = "deny"; + enable-login = true; + require-login = true; + }; + environmentFile = config.age.secrets.ntfy.path; + }; + + services.caddy.virtualHosts = { + "ntfy.${config.networking.domain}" = { + extraConfig = '' + reverse_proxy ${config.services.ntfy-sh.settings.listen-http} + ''; + }; + }; +}