mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
types.attrsOf: Use mergeDefinitions to handle each element
This simplifes typechecking and allows properties to be used inside of the attribute sets. This fixes the empty synergy-client and synergy-server services previously generated on systems with synergy disabled.
This commit is contained in:
parent
e4bc2592f3
commit
8737d1783f
@ -126,12 +126,16 @@ in rec {
|
||||
|
||||
attrsOf = elemType: mkOptionType {
|
||||
name = "attribute set of ${elemType.name}s";
|
||||
check = x: isAttrs x && all elemType.check (attrValues x);
|
||||
check = isAttrs;
|
||||
merge = loc: defs:
|
||||
zipAttrsWith (name: elemType.merge (loc ++ [name]))
|
||||
mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
|
||||
let
|
||||
inherit (mergeDefinitions (loc ++ [name]) elemType defs)
|
||||
defsFinal mergedValue;
|
||||
in if defsFinal == [] then {} else { value = mergedValue; })
|
||||
# Push down position info.
|
||||
(map (def: listToAttrs (mapAttrsToList (n: def':
|
||||
{ name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs);
|
||||
{ name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs)));
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: attrsOf (elemType.substSubModules m);
|
||||
|
Loading…
Reference in New Issue
Block a user