diff --git a/modules/nixos/services/systemd-email-notify/default.nix b/modules/nixos/services/systemd-email-notify/default.nix new file mode 100644 index 0000000..2a812ee --- /dev/null +++ b/modules/nixos/services/systemd-email-notify/default.nix @@ -0,0 +1,73 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; + +let + checkConditions = pkgs.writeScript "checkConditions" '' + #!/bin/sh + STATUS=$(systemctl status --full "$1") + + case "$STATUS" in + *"activating (auto-restart) (Result: timeout)"*) exit 1 ;; + *) exit 0 ;; + esac + ''; + + sendmail = pkgs.writeScript "sendmail" '' + #!/bin/sh + + ${pkgs.system-sendmail}/bin/sendmail -t <