aboutsummaryrefslogtreecommitdiffstats
path: root/home/ntfy.nix
blob: 06f0d38023171120c749d911d101e7504c67e30b (plain) (blame)
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, pkgs, ... }:
{

  systemd.user.services.ntfy-client = {
    Unit = {
      Description = "ntfy client subscriber";
      After = [ "graphical.target" ];
    };

    Install = {
      WantedBy = [ "default.target" ];
    };

    Service = {
      ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe --config /home/petri/.config/ntfy/client.yml --from-config";
      Restart = "on-failure";
      RestartSec = "10s";
      ProtectSystem = "strict";
      ProtectHome = "read-only";
      PrivateTmp = true;
      NoNewPrivileges = true;
      RestrictRealtime = true;
      LockPersonality = true;
    };
  };

  xdg.configFile."ntfy/client.yml".source = (pkgs.formats.yaml { }).generate "ntfy-client-config" {
    "default-host" = "https://ntfy.tammi.cc";
    subscribe = [
      {
        topic = "77WxlkfsTzGrbYFw";
        host = "https://ntfy.tammi.cc";
        since = "1h";
        persist = true;
        keepalive = "45s";
        format = "markdown";
      }
    ];
  };
}