Merge pull request #41446 from aszlig/make-serviceconfig-overridable

nixos/systemd: Allow to override serviceConfig
This commit is contained in:
Eelco Dolstra 2018-06-05 17:35:28 +02:00 committed by GitHub
commit 70faa56775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"