mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
lib.modules: simplified logic in usage of zipAttrsWith and minor cleanup (#388748)
This commit is contained in:
commit
d2c9829366
1 changed files with 5 additions and 7 deletions
|
@ -320,7 +320,6 @@ let
|
||||||
prefix ? [],
|
prefix ? [],
|
||||||
}:
|
}:
|
||||||
evalModules (evalModulesArgs // {
|
evalModules (evalModulesArgs // {
|
||||||
inherit class;
|
|
||||||
modules = regularModules ++ modules;
|
modules = regularModules ++ modules;
|
||||||
specialArgs = evalModulesArgs.specialArgs or {} // specialArgs;
|
specialArgs = evalModulesArgs.specialArgs or {} // specialArgs;
|
||||||
prefix = extendArgs.prefix or evalModulesArgs.prefix or [];
|
prefix = extendArgs.prefix or evalModulesArgs.prefix or [];
|
||||||
|
@ -335,8 +334,7 @@ let
|
||||||
options = checked options;
|
options = checked options;
|
||||||
config = checked (removeAttrs config [ "_module" ]);
|
config = checked (removeAttrs config [ "_module" ]);
|
||||||
_module = checked (config._module);
|
_module = checked (config._module);
|
||||||
inherit extendModules type;
|
inherit extendModules type class;
|
||||||
class = class;
|
|
||||||
};
|
};
|
||||||
in result;
|
in result;
|
||||||
|
|
||||||
|
@ -602,7 +600,7 @@ let
|
||||||
# an attrset 'name' => list of submodules that declare ‘name’.
|
# an attrset 'name' => list of submodules that declare ‘name’.
|
||||||
declsByName =
|
declsByName =
|
||||||
zipAttrsWith
|
zipAttrsWith
|
||||||
(n: concatLists)
|
(n: v: v)
|
||||||
(map
|
(map
|
||||||
(module: let subtree = module.options; in
|
(module: let subtree = module.options; in
|
||||||
if !(isAttrs subtree) then
|
if !(isAttrs subtree) then
|
||||||
|
@ -614,7 +612,7 @@ let
|
||||||
else
|
else
|
||||||
mapAttrs
|
mapAttrs
|
||||||
(n: option:
|
(n: option:
|
||||||
[{ inherit (module) _file; pos = unsafeGetAttrPos n subtree; options = option; }]
|
{ inherit (module) _file; pos = unsafeGetAttrPos n subtree; options = option; }
|
||||||
)
|
)
|
||||||
subtree
|
subtree
|
||||||
)
|
)
|
||||||
|
@ -657,12 +655,12 @@ let
|
||||||
# extract the definitions for each loc
|
# extract the definitions for each loc
|
||||||
rawDefinitionsByName =
|
rawDefinitionsByName =
|
||||||
zipAttrsWith
|
zipAttrsWith
|
||||||
(n: concatLists)
|
(n: v: v)
|
||||||
(map
|
(map
|
||||||
(module:
|
(module:
|
||||||
mapAttrs
|
mapAttrs
|
||||||
(n: value:
|
(n: value:
|
||||||
[{ inherit (module) file; inherit value; }]
|
{ inherit (module) file; inherit value; }
|
||||||
)
|
)
|
||||||
module.config
|
module.config
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue