diff options
-rw-r--r-- | custom/unit-status-mail.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/custom/unit-status-mail.nix b/custom/unit-status-mail.nix index 4ad08667..58136724 100644 --- a/custom/unit-status-mail.nix +++ b/custom/unit-status-mail.nix | |||
@@ -4,6 +4,9 @@ with lib; | |||
4 | 4 | ||
5 | let | 5 | let |
6 | cfg = config.systemd.status-mail; | 6 | cfg = config.systemd.status-mail; |
7 | |||
8 | serviceCfg = traceValSeq (foldl singleServiceCfg {} cfg.onFailure); | ||
9 | singleServiceCfg = attrs: unitName: attrs // (setAttrByPath [unitName "onFailure"] ["unit-status-mail@%n.service"]); | ||
7 | in { | 10 | in { |
8 | options = { | 11 | options = { |
9 | systemd.status-mail = { | 12 | systemd.status-mail = { |
@@ -26,9 +29,7 @@ in { | |||
26 | }; | 29 | }; |
27 | 30 | ||
28 | config = mkIf (cfg.onFailure != []) { | 31 | config = mkIf (cfg.onFailure != []) { |
29 | systemd.services = let | 32 | systemd.services = config.systemd.services // serviceCfg; |
30 | singleServiceCfg = attrs: unitName: attrs // (setAttrByPath [unitName "onFailure"] ["unit-status-mail@%n.service"]); | ||
31 | in foldl singleServiceCfg {} cfg.onFailure; | ||
32 | 33 | ||
33 | systemd.services."unit-status-mail@" = { | 34 | systemd.services."unit-status-mail@" = { |
34 | serviceConfig = { | 35 | serviceConfig = { |