2025-02-08 12:58:06 -05:00

41 lines
1.0 KiB
Nix

{ config, lib, ... }:
let
cfg = config.nmasur.presets.services.ntfy-sh;
hostnames = config.nmasur.settings.hostnames;
in
{
options.nmasur.presets.services.ntfy-sh.enable = lib.mkEnableOption "ntfy notification service";
config = lib.mkIf cfg.enable {
services.ntfy-sh = {
enable = true;
settings = {
base-url = "https://${hostnames.notifications}";
upstream-base-url = "https://ntfy.sh";
listen-http = ":8333";
behind-proxy = true;
auth-default-access = "deny-all";
auth-file = "/var/lib/ntfy-sh/user.db";
};
};
caddy.routes = [
{
match = [ { host = [ hostnames.notifications ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost${config.services.ntfy-sh.settings.listen-http}"; } ];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.notifications ];
};
}