about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2018-06-05 17:35:28 +0200
committerGitHub <noreply@github.com>2018-06-05 17:35:28 +0200
commit70faa56775c86c2294ce95cdd7164f81f1888355 (patch)
treef28a0489e6e900fd759cc77775f6c926f2d86ce7 /nixos/modules
parent527f11bde380ebe3a31857bf3157b31ba6b3a14a (diff)
parent0e7c945e15117e88ac494e29c9828ccea2ec32ee (diff)
downloadnixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar.gz
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar.bz2
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar.lz
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar.xz
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.tar.zst
nixlib-70faa56775c86c2294ce95cdd7164f81f1888355.zip
Merge pull request #41446 from aszlig/make-serviceconfig-overridable
nixos/systemd: Allow to override serviceConfig
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/system/boot/systemd-lib.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix
index ae9ee8811f77..8b37bf8d35d8 100644
--- a/nixos/modules/system/boot/systemd-lib.nix
+++ b/nixos/modules/system/boot/systemd-lib.nix
@@ -78,10 +78,16 @@ in rec {
     optional (badFields != [ ])
       "Systemd ${group} has extra fields [${concatStringsSep " " badFields}].";
 
-  checkUnitConfig = group: checks: v:
-    let errors = concatMap (c: c group v) checks; in
-    if errors == [] then true
-      else builtins.trace (concatStringsSep "\n" errors) false;
+  checkUnitConfig = group: checks: attrs: let
+    # We're applied at the top-level type (attrsOf unitOption), so the actual
+    # unit options might contain attributes from mkOverride that we need to
+    # convert into single values before checking them.
+    defs = mapAttrs (const (v:
+      if v._type or "" == "override" then v.content else v
+    )) attrs;
+    errors = concatMap (c: c group defs) checks;
+  in if errors == [] then true
+     else builtins.trace (concatStringsSep "\n" errors) false;
 
   toOption = x:
     if x == true then "true"