nixos-config/nixos/profiles/services/ntfy/default.nix

42 lines
949 B
Nix
Raw Permalink Normal View History

2024-12-15 01:20:55 +08:00
{
config,
lib,
mylib,
...
}:
{
services.ntfy-sh = {
enable = true;
settings = {
base-url = "https://push.rebmit.moe";
2024-12-15 02:52:27 +08:00
listen-http = "127.0.0.1:${toString config.networking.ports.ntfy}";
2024-12-15 01:20:55 +08:00
auth-default-access = "deny-all";
behind-proxy = true;
};
};
systemd.services.ntfy-sh.serviceConfig = mylib.misc.serviceHardened // {
AmbientCapabilities = lib.mkForce [ "" ];
CapabilityBoundingSet = lib.mkForce [ "" ];
2024-12-15 01:20:55 +08:00
DynamicUser = lib.mkForce false;
};
services.caddy.virtualHosts."push.rebmit.moe" = {
serverAliases = [ "push.rebmit.workers.moe" ];
extraConfig = ''
reverse_proxy ${config.services.ntfy-sh.settings.listen-http}
'';
2024-12-15 01:20:55 +08:00
};
preservation.preserveAt."/persist".directories = [
{
directory = "/var/lib/ntfy-sh";
mode = "-";
user = "-";
group = "-";
}
];
services.restic.backups.b2.paths = [ "/persist/var/lib/ntfy-sh" ];
2024-12-15 01:20:55 +08:00
}