40 lines
1004 B
Nix
Raw Permalink Normal View History

2024-08-25 21:04:16 +00:00
{ config, lib, ... }:
2025-01-20 22:35:40 -05:00
let
cfg = config.nmasur.presets.services.ntfy-sh;
in
2024-08-25 21:04:16 +00:00
{
2025-01-20 22:35:40 -05:00
options.nmasur.presets.services.ntfy-sh.enable = lib.mkEnableOption "ntfy notification service";
2024-08-25 21:04:16 +00:00
2025-01-20 22:35:40 -05:00
config = lib.mkIf cfg.enable {
2024-08-25 21:04:16 +00:00
services.ntfy-sh = {
2025-01-20 22:35:40 -05:00
enable = true;
2024-09-14 22:13:13 +00:00
settings = {
2024-08-25 21:04:16 +00:00
base-url = "https://${config.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 = [ config.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 = [ config.hostnames.notifications ];
};
}