mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
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:
|
||||
let
|
||||
# an attrset 'name' => list of submodules that declare ‘name’.
|
||||
declsByName = (f: modules:
|
||||
declsByName = (modules:
|
||||
zipAttrsWith (n: concatLists)
|
||||
(map (module: let subtree = module.options; in
|
||||
if !(builtins.isAttrs subtree) then
|
||||
@ -550,12 +550,14 @@ let
|
||||
Did you mean to define this outside of `options'?
|
||||
''
|
||||
else
|
||||
mapAttrs (n: f module) subtree
|
||||
) modules)) (module: option:
|
||||
mapAttrs
|
||||
(n: (module: option:
|
||||
[{ inherit (module) _file; options = option; }]
|
||||
) options;
|
||||
) module)
|
||||
subtree
|
||||
) modules)) options;
|
||||
# an attrset 'name' => list of submodules that define ‘name’.
|
||||
defnsByName = (f: modules:
|
||||
defnsByName = (modules:
|
||||
zipAttrsWith (n: concatLists)
|
||||
(map (module: let subtree = module.config; in
|
||||
if !(builtins.isAttrs subtree) then
|
||||
@ -569,12 +571,14 @@ let
|
||||
this option by e.g. referring to `man 5 configuration.nix'!
|
||||
''
|
||||
else
|
||||
mapAttrs (n: f module) subtree
|
||||
) modules)) (module: value:
|
||||
mapAttrs
|
||||
(n: (module: value:
|
||||
map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)
|
||||
) configs;
|
||||
) module)
|
||||
subtree
|
||||
) modules)) configs;
|
||||
# extract the definitions for each loc
|
||||
defnsByName' = (f: modules:
|
||||
defnsByName' = (modules:
|
||||
zipAttrsWith (n: concatLists)
|
||||
(map (module: let subtree = module.config; in
|
||||
if !(builtins.isAttrs subtree) then
|
||||
@ -588,10 +592,12 @@ let
|
||||
this option by e.g. referring to `man 5 configuration.nix'!
|
||||
''
|
||||
else
|
||||
mapAttrs (n: f module) subtree
|
||||
) modules)) (module: value:
|
||||
mapAttrs
|
||||
(n: (module: value:
|
||||
[{ inherit (module) file; inherit value; }]
|
||||
) configs;
|
||||
) module)
|
||||
subtree
|
||||
) modules)) configs;
|
||||
|
||||
# Convert an option tree decl to a submodule option decl
|
||||
optionTreeToOption = decl:
|
||||
|
Loading…
Reference in New Issue
Block a user