diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-30 19:29:50 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-30 19:29:50 +0200 |
commit | 0dc4a6fa21ec216cc3145a5867025117eea8e8ce (patch) | |
tree | 161ca5db3e6942f86c5991f4d6b4513395458bee | |
parent | afc2aec6b3257ef665891f50b3630e78ffb48ea8 (diff) | |
download | nixos-0dc4a6fa21ec216cc3145a5867025117eea8e8ce.tar nixos-0dc4a6fa21ec216cc3145a5867025117eea8e8ce.tar.gz nixos-0dc4a6fa21ec216cc3145a5867025117eea8e8ce.tar.bz2 nixos-0dc4a6fa21ec216cc3145a5867025117eea8e8ce.tar.xz nixos-0dc4a6fa21ec216cc3145a5867025117eea8e8ce.zip |
refactor
-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 | } |