diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2018-06-05 17:35:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 17:35:28 +0200 |
commit | 70faa56775c86c2294ce95cdd7164f81f1888355 (patch) | |
tree | f28a0489e6e900fd759cc77775f6c926f2d86ce7 /nixos/modules | |
parent | 527f11bde380ebe3a31857bf3157b31ba6b3a14a (diff) | |
parent | 0e7c945e15117e88ac494e29c9828ccea2ec32ee (diff) | |
download | nixlib-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.nix | 14 |
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" |