summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-07-30 19:29:50 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2017-07-30 19:29:50 +0200
commit0dc4a6fa21ec216cc3145a5867025117eea8e8ce (patch)
tree161ca5db3e6942f86c5991f4d6b4513395458bee
parentafc2aec6b3257ef665891f50b3630e78ffb48ea8 (diff)
downloadnixos-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.nix7
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;
5let 5let
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"]);
10in { 9in {
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}