40 lines
911 B
Nix
40 lines
911 B
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.custom.seven.ntfy;
|
|
in
|
|
{
|
|
options = {
|
|
custom.seven.ntfy = {
|
|
enable = lib.mkEnableOption (lib.mdDoc "ntfy service for seven");
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.user = {
|
|
services.ntfy = {
|
|
Unit = {
|
|
Description = "ntfy alert scubscription";
|
|
After = "network-online.target";
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
Service =
|
|
let
|
|
topic = "https://grafana.factory.secunet.com/ntfy/alerts";
|
|
notify-send = lib.getExe pkgs.libnotify;
|
|
in
|
|
{
|
|
Environment = "PATH=${pkgs.bash}/bin:\${PATH}";
|
|
ExecStart = "${pkgs.ntfy-sh}/bin/ntfy sub ${topic} '${notify-send} \"$t\" \"$m\"'";
|
|
Restart = "always";
|
|
};
|
|
Install.WantedBy = [ "default.target" ];
|
|
};
|
|
};
|
|
};
|
|
}
|