commit 59f428c197d6a8ddd5f2c41cfa0e28100b8c83fa
parent c22422ed404e00995726d3193ab4e4021edd3f14
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 23 Mar 2025 12:28:19 +0100
parent c22422ed404e00995726d3193ab4e4021edd3f14
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 23 Mar 2025 12:28:19 +0100
modules/nixos: add `nftysh-notify`
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix @@ -17,6 +17,7 @@ ./restic-backups.nix ./gitolite.nix ./email-notify.nix + ./ntfysh-notify.nix ./dns.nix ./gotosocial.nix ./gnome.nix
diff --git a/modules/nixos/ntfysh-notify.nix b/modules/nixos/ntfysh-notify.nix @@ -0,0 +1,20 @@ +{ secrets, pkgs, lib, config, ... }: + +{ + + options.services.ntfysh-notify.enable = lib.mkEnableOption ""; + + config = lib.mkIf config.services.ntfysh-notify.enable { + age.secrets.ntfyshEnv.file = secrets.allNodes.ntfyshEnv; + + systemd.services."ntfysh-notify-failure@" = { + serviceConfig = { + EnvironmentFile = config.age.secrets.ntfyshEnv.path; + ExecStart = '' + ${pkgs.runtimeShell} -c '${lib.getExe pkgs.curl} -H "Tags: $NTFY_TAGS" -H "Firebase: no" -d "[%H] Service %i failed\n$(journalctl --unit %i --lines 5 --reverse --no-pager --boot | ${pkgs.coreutils}/bin/head -c 4095)" $NTFY_URL/$NTFY_TOPIC' + ''; + }; + }; + }; + +}