From eaf585b8d3082c69a3659743ca0b685063321d98 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 30 Jul 2017 19:37:17 +0200 Subject: =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom/unit-status-mail.nix | 7 ++++--- 1 file 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; let cfg = config.systemd.status-mail; + + serviceCfg = traceValSeq (foldl singleServiceCfg {} cfg.onFailure); + singleServiceCfg = attrs: unitName: attrs // (setAttrByPath [unitName "onFailure"] ["unit-status-mail@%n.service"]); in { options = { systemd.status-mail = { @@ -26,9 +29,7 @@ in { }; config = mkIf (cfg.onFailure != []) { - systemd.services = let - singleServiceCfg = attrs: unitName: attrs // (setAttrByPath [unitName "onFailure"] ["unit-status-mail@%n.service"]); - in foldl singleServiceCfg {} cfg.onFailure; + systemd.services = config.systemd.services // serviceCfg; systemd.services."unit-status-mail@" = { serviceConfig = { -- cgit v1.2.3