lib/modules.nix: Apply argument f
of old old byName
This commit is contained in:
parent
c70a5e9223
commit
65de18210d
|
@ -540,7 +540,7 @@ let
|
||||||
mergeModules' = prefix: options: configs:
|
mergeModules' = prefix: options: configs:
|
||||||
let
|
let
|
||||||
# an attrset 'name' => list of submodules that declare ‘name’.
|
# an attrset 'name' => list of submodules that declare ‘name’.
|
||||||
declsByName = (f: modules:
|
declsByName = (modules:
|
||||||
zipAttrsWith (n: concatLists)
|
zipAttrsWith (n: concatLists)
|
||||||
(map (module: let subtree = module.options; in
|
(map (module: let subtree = module.options; in
|
||||||
if !(builtins.isAttrs subtree) then
|
if !(builtins.isAttrs subtree) then
|
||||||
|
@ -550,12 +550,14 @@ let
|
||||||
Did you mean to define this outside of `options'?
|
Did you mean to define this outside of `options'?
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
mapAttrs (n: f module) subtree
|
mapAttrs
|
||||||
) modules)) (module: option:
|
(n: (module: option:
|
||||||
[{ inherit (module) _file; options = option; }]
|
[{ inherit (module) _file; options = option; }]
|
||||||
) options;
|
) module)
|
||||||
|
subtree
|
||||||
|
) modules)) options;
|
||||||
# an attrset 'name' => list of submodules that define ‘name’.
|
# an attrset 'name' => list of submodules that define ‘name’.
|
||||||
defnsByName = (f: modules:
|
defnsByName = (modules:
|
||||||
zipAttrsWith (n: concatLists)
|
zipAttrsWith (n: concatLists)
|
||||||
(map (module: let subtree = module.config; in
|
(map (module: let subtree = module.config; in
|
||||||
if !(builtins.isAttrs subtree) then
|
if !(builtins.isAttrs subtree) then
|
||||||
|
@ -569,12 +571,14 @@ let
|
||||||
this option by e.g. referring to `man 5 configuration.nix'!
|
this option by e.g. referring to `man 5 configuration.nix'!
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
mapAttrs (n: f module) subtree
|
mapAttrs
|
||||||
) modules)) (module: value:
|
(n: (module: value:
|
||||||
map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)
|
map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)
|
||||||
) configs;
|
) module)
|
||||||
|
subtree
|
||||||
|
) modules)) configs;
|
||||||
# extract the definitions for each loc
|
# extract the definitions for each loc
|
||||||
defnsByName' = (f: modules:
|
defnsByName' = (modules:
|
||||||
zipAttrsWith (n: concatLists)
|
zipAttrsWith (n: concatLists)
|
||||||
(map (module: let subtree = module.config; in
|
(map (module: let subtree = module.config; in
|
||||||
if !(builtins.isAttrs subtree) then
|
if !(builtins.isAttrs subtree) then
|
||||||
|
@ -588,10 +592,12 @@ let
|
||||||
this option by e.g. referring to `man 5 configuration.nix'!
|
this option by e.g. referring to `man 5 configuration.nix'!
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
mapAttrs (n: f module) subtree
|
mapAttrs
|
||||||
) modules)) (module: value:
|
(n: (module: value:
|
||||||
[{ inherit (module) file; inherit value; }]
|
[{ inherit (module) file; inherit value; }]
|
||||||
) configs;
|
) module)
|
||||||
|
subtree
|
||||||
|
) modules)) configs;
|
||||||
|
|
||||||
# Convert an option tree decl to a submodule option decl
|
# Convert an option tree decl to a submodule option decl
|
||||||
optionTreeToOption = decl:
|
optionTreeToOption = decl:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user