configuration.nix/hosts/wynne/services/apps/ntfy.nix

45 lines
1.4 KiB
Nix
Raw Normal View History

2024-09-18 00:30:39 +05:30
{ lib, config, ... }:
2024-09-17 23:13:44 +05:30
let
2024-10-27 23:09:50 +05:30
inherit (import ../../../shared/caddy-helpers.nix) logFormat tlsAcmeDnsChallenge;
2024-09-17 23:13:44 +05:30
domainName = "ntfy.acomputer.lol";
in
{
services = {
2024-09-18 00:30:39 +05:30
caddy.virtualHosts = {
"${config.networking.hostName}.labs.adtya.xyz" = {
2024-10-27 23:09:50 +05:30
inherit logFormat;
2024-09-18 00:30:39 +05:30
extraConfig = ''
2024-10-27 23:09:50 +05:30
${tlsAcmeDnsChallenge}
2024-09-19 19:08:48 +05:30
handle /ntfy-metrics {
uri replace /ntfy-metrics /metrics
reverse_proxy ${config.services.ntfy-sh.settings.metrics-listen-http}
}
2024-09-18 00:30:39 +05:30
'';
};
2024-09-17 23:13:44 +05:30
};
ntfy-sh = {
enable = true;
settings = {
base-url = "https://${domainName}";
listen-http = "10.10.10.13:8080";
2024-09-18 00:30:39 +05:30
metrics-listen-http = "127.0.0.1:8081";
2024-09-17 23:47:19 +05:30
auth-file = "/mnt/data/ntfy-sh/user.db";
attachment-cache-dir = "/mnt/data/ntfy-sh/attachments";
cache-file = "/mnt/data/ntfy-sh/cache-file.db";
2024-10-25 22:57:53 +05:30
enable-login = true;
2024-09-17 23:47:19 +05:30
auth-default-access = "deny-all";
2024-09-17 23:13:44 +05:30
};
};
};
2024-09-17 23:47:19 +05:30
systemd.services.ntfy-sh.unitConfig.RequiresMountsFor = [ "/mnt/data" ];
2024-09-18 00:30:39 +05:30
systemd.services.ntfy-sh.serviceConfig.WorkingDirectory = "/mnt/data/ntfy-sh";
systemd.services.ntfy-sh.serviceConfig.User = "ntfy-sh";
systemd.services.ntfy-sh.serviceConfig.Group = "ntfy-sh";
systemd.services.ntfy-sh.serviceConfig.DynamicUser = lib.mkForce false;
users.users.ntfy-sh.home = "/mnt/data/ntfy-sh";
users.users.ntfy-sh.createHome = true;
2024-09-17 23:13:44 +05:30
}