summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/unit-status-mail.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/custom/unit-status-mail.nix b/custom/unit-status-mail.nix
index 13717ce9..4ad08667 100644
--- a/custom/unit-status-mail.nix
+++ b/custom/unit-status-mail.nix
@@ -4,8 +4,6 @@ with lib;
4 4
5let 5let
6 cfg = config.systemd.status-mail; 6 cfg = config.systemd.status-mail;
7
8 serviceCfg = attrs: unitName: attrs // (setAttrByPath ["systemd" "services" unitName "onFailure"] ["unit-status-mail@%n.service"]);
9in { 7in {
10 options = { 8 options = {
11 systemd.status-mail = { 9 systemd.status-mail = {
@@ -27,7 +25,11 @@ in {
27 }; 25 };
28 }; 26 };
29 27
30 config = mkIf (cfg.onFailure != []) (foldl serviceCfg { 28 config = mkIf (cfg.onFailure != []) {
29 systemd.services = let
30 singleServiceCfg = attrs: unitName: attrs // (setAttrByPath [unitName "onFailure"] ["unit-status-mail@%n.service"]);
31 in foldl singleServiceCfg {} cfg.onFailure;
32
31 systemd.services."unit-status-mail@" = { 33 systemd.services."unit-status-mail@" = {
32 serviceConfig = { 34 serviceConfig = {
33 Type = "oneshot"; 35 Type = "oneshot";
@@ -58,5 +60,5 @@ in {
58 EOF 60 EOF
59 ''; 61 '';
60 }; 62 };
61 } cfg.onFailure); 63 };
62} 64}