all repos — nixfiles @ 2e2883cbb2f61bfebbad09fa2a082df7375e8fe4

System and user configuration, managed by nix and home-manager

system/roles/push-notifications.nix (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
  config,
  ...
}:
{
  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;
    };
  };

  services.caddy.virtualHosts = {
    "ntfy.${config.networking.domain}" = {
      extraConfig = ''
        reverse_proxy ${config.services.ntfy-sh.settings.listen-http}
      '';
    };
    "notify.${config.networking.domain}" = {
      extraConfig = ''
        reverse_proxy ${config.services.bark.settings.BARK_SERVER_ADDRESS} {
          health_uri /ping
          health_body pong
        }
      '';
    };
  };

  services.bark = {
    enable = true;
    settings = {
      BARK_SERVER_ADDRESS = "[::1]:8089";
    };
  };
}