diff --git a/modules/nixos/system/default.nix b/modules/nixos/system/default.nix index 2931f8d..8a6e27f 100644 --- a/modules/nixos/system/default.nix +++ b/modules/nixos/system/default.nix @@ -28,6 +28,8 @@ upper = "06:00"; }; }; + + # Create an email notification service for failed jobs systemd.services."notify-email@" = let address = "system@${config.mail.server}"; in { @@ -48,6 +50,8 @@ ${address} < $TEMPFILE ''; }; + + # Send an email whenever auto upgrade fails systemd.services.nixos-upgrade.onFailure = lib.mkIf config.systemd.services."notify-email@".enable [ "notify-email@%i.service" ];