summaryrefslogtreecommitdiff
path: root/ymir.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ymir.nix')
-rw-r--r--ymir.nix33
1 files changed, 3 insertions, 30 deletions
diff --git a/ymir.nix b/ymir.nix
index fd373220..00149d06 100644
--- a/ymir.nix
+++ b/ymir.nix
@@ -32,6 +32,7 @@ in rec {
32 ./custom/tinc/def.nix 32 ./custom/tinc/def.nix
33 ./custom/ymir-nginx.nix 33 ./custom/ymir-nginx.nix
34 ./custom/uucp.nix 34 ./custom/uucp.nix
35 ./custom/unit-status-mail.nix
35 ]; 36 ];
36 37
37 boot.loader.grub = { 38 boot.loader.grub = {
@@ -898,36 +899,8 @@ in rec {
898 git -C /etc/nixos pull 899 git -C /etc/nixos pull
899 git -C /etc/nixos submodule update 900 git -C /etc/nixos submodule update
900 ''; 901 '';
901 systemd.services."nixos-upgrade".onFailure = ["unit-status-mail@%n.service"];
902 902
903 systemd.services."unit-status-mail@" = { 903 systemd.status-mail = {
904 serviceConfig = { 904 onFailure = [ "nixos-upgrade" ];
905 Type = "oneshot";
906 };
907 scriptArgs = "%I \"Hostname: %H\" \"Machine-ID: %m\" \"Boot-ID: %b\"";
908 script = ''
909 #!${pkgs.stdenv.shell}
910 MAILTO="root"
911 MAILFROM="unit-status-mailer"
912 UNIT=$1
913
914 EXTRA=""
915 for e in "''${@:2}"; do
916 EXTRA+="$e"$'\n'
917 done
918
919 UNITSTATUS=$(systemctl status $UNIT)
920
921 ${config.security.wrapperDir}/sendmail $MAILTO <<EOF
922 From:$MAILFROM
923 To:$MAILTO
924 Subject:Status of $UNIT
925
926 Status report for unit: $UNIT
927 $EXTRA
928
929 $UNITSTATUS
930 EOF
931 '';
932 }; 905 };
933} 906}