Fix indentation
This commit is contained in:
parent
c60e4016e7
commit
0ca10a445a
|
@ -281,38 +281,39 @@ rec {
|
||||||
inherit isDefined files;
|
inherit isDefined files;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Merge definitions of a value of a given type
|
# Merge definitions of a value of a given type.
|
||||||
mergeDefinitions = loc: type: defs: rec {
|
mergeDefinitions = loc: type: defs: rec {
|
||||||
defsFinal =
|
defsFinal =
|
||||||
let
|
let
|
||||||
# Process mkMerge and mkIf properties
|
# Process mkMerge and mkIf properties
|
||||||
processIfAndMerge = defs: concatMap (m:
|
processIfAndMerge = defs: concatMap (m:
|
||||||
map (value: { inherit (m) file; inherit value; }) (dischargeProperties m.value)
|
map (value: { inherit (m) file; inherit value; }) (dischargeProperties m.value)
|
||||||
) defs;
|
) defs;
|
||||||
|
|
||||||
# Process mkOverride properties
|
# Process mkOverride properties
|
||||||
processOverride = defs: filterOverrides defs;
|
processOverride = defs: filterOverrides defs;
|
||||||
|
|
||||||
# Sort mkOrder properties
|
# Sort mkOrder properties
|
||||||
processOrder = defs:
|
processOrder = defs:
|
||||||
# Avoid sorting if we don't have to.
|
# Avoid sorting if we don't have to.
|
||||||
if any (def: def.value._type or "" == "order") defs
|
if any (def: def.value._type or "" == "order") defs
|
||||||
then sortProperties defs
|
then sortProperties defs
|
||||||
else defs;
|
else defs;
|
||||||
in
|
in
|
||||||
processOrder (processOverride (processIfAndMerge defs));
|
processOrder (processOverride (processIfAndMerge defs));
|
||||||
|
|
||||||
# Type-check the remaining definitions, and merge them.
|
# Type-check the remaining definitions, and merge them.
|
||||||
mergedValue = foldl' (res: def:
|
mergedValue = foldl' (res: def:
|
||||||
if type.check def.value then res
|
if type.check def.value then res
|
||||||
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
|
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
|
||||||
(type.merge loc defsFinal) defsFinal;
|
(type.merge loc defsFinal) defsFinal;
|
||||||
|
|
||||||
isDefined = defsFinal != [];
|
isDefined = defsFinal != [];
|
||||||
optionalValue =
|
|
||||||
if isDefined then { value = mergedValue; }
|
optionalValue =
|
||||||
else {};
|
if isDefined then { value = mergedValue; }
|
||||||
};
|
else {};
|
||||||
|
};
|
||||||
|
|
||||||
/* Given a config set, expand mkMerge properties, and push down the
|
/* Given a config set, expand mkMerge properties, and push down the
|
||||||
other properties into the children. The result is a list of
|
other properties into the children. The result is a list of
|
||||||
|
|
Loading…
Reference in New Issue