diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-30 19:32:57 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-30 19:32:57 +0200 |
| commit | 5c891e28bf02c00ca0762c873bab86db1b40cfcd (patch) | |
| tree | 8b150ef171f279bdc264c132579fdced27c794df /custom | |
| parent | c01e98c5e5c47b9578a948901a4307d1f710faa3 (diff) | |
| download | nixos-5c891e28bf02c00ca0762c873bab86db1b40cfcd.tar nixos-5c891e28bf02c00ca0762c873bab86db1b40cfcd.tar.gz nixos-5c891e28bf02c00ca0762c873bab86db1b40cfcd.tar.bz2 nixos-5c891e28bf02c00ca0762c873bab86db1b40cfcd.tar.xz nixos-5c891e28bf02c00ca0762c873bab86db1b40cfcd.zip | |
refactor
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/unit-status-mail.nix | 10 |
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 | ||
| 5 | let | 5 | let |
| 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"]); | ||
| 9 | in { | 7 | in { |
| 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 | } |
