mergeAttrDefinitionsWithPrio
lib.modules.mergeAttrDefinitionsWithPrio
Docs pulled from | This Revision | 16 minutes ago
Merge an option's definitions in a way that preserves the priority of the individual attributes in the option value.
This does not account for all option semantics, such as readOnly.
Inputs
opt
-
1. Function argument
Type
option -> attrsOf { highestPrio, value }
Noogle detected
Implementation
The following is the current implementation of this function.
mergeAttrDefinitionsWithPrio =
opt:
let
defsByAttr = zipAttrs (
concatLists (
concatMap (
{ value, ... }@def:
map (mapAttrsToList (
k: value: {
${k} = def // {
inherit value;
};
}
)) (pushDownProperties value)
) opt.definitionsWithLocations
)
);
in
assert opt.type.name == "attrsOf" || opt.type.name == "lazyAttrsOf";
mapAttrs (
k: v:
let
merging = mergeDefinitions (opt.loc ++ [ k ]) opt.type.nestedTypes.elemType v;
in
{
value = merging.mergedValue;
inherit (merging.defsFinal') highestPrio;
}
) defsByAttr;