diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/unit-status-mail.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/custom/unit-status-mail.nix b/custom/unit-status-mail.nix index c1947063..e43706ea 100644 --- a/custom/unit-status-mail.nix +++ b/custom/unit-status-mail.nix | |||
@@ -5,8 +5,7 @@ with lib; | |||
5 | let | 5 | let |
6 | cfg = config.systemd.status-mail; | 6 | cfg = config.systemd.status-mail; |
7 | 7 | ||
8 | systemdCfg = foldr singleCfg {} cfg.onFailure; | 8 | serviceCfg = unitName: attrs: attrs // (setAttrByPath ["systemd" "services" unitName "onFailure"] ["unit-status-mail@%n.service"]); |
9 | singleCfg = unitName: attrs: attrs // (setAttrByPath ["systemd" "services" unitName "onFailure"] ["unit-status-mail@%n.service"]); | ||
10 | in { | 9 | in { |
11 | options = { | 10 | options = { |
12 | systemd.status-mail = { | 11 | systemd.status-mail = { |
@@ -28,7 +27,7 @@ in { | |||
28 | }; | 27 | }; |
29 | }; | 28 | }; |
30 | 29 | ||
31 | config = mkIf (cfg.onFailure != []) { | 30 | config = mkIf (cfg.onFailure != []) (foldr serviceCfg { |
32 | systemd.services."unit-status-mail@" = { | 31 | systemd.services."unit-status-mail@" = { |
33 | serviceConfig = { | 32 | serviceConfig = { |
34 | Type = "oneshot"; | 33 | Type = "oneshot"; |
@@ -59,5 +58,5 @@ in { | |||
59 | EOF | 58 | EOF |
60 | ''; | 59 | ''; |
61 | }; | 60 | }; |
62 | }; | 61 | } cfg.onFailure); |
63 | } | 62 | } |