mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
lib/types: Simplify submoduleWith shorthandOnlyDefinesConfig handling
The module system already uses the parent module's _file as a fallback, so we don't need to inject the file in a weird way
This commit is contained in:
parent
79441600c2
commit
907627f656
@ -580,19 +580,10 @@ rec {
|
|||||||
let
|
let
|
||||||
inherit (lib.modules) evalModules;
|
inherit (lib.modules) evalModules;
|
||||||
|
|
||||||
shorthandToModule = if shorthandOnlyDefinesConfig == false
|
|
||||||
then value: value
|
|
||||||
else value: { config = value; };
|
|
||||||
|
|
||||||
allModules = defs: imap1 (n: { value, file }:
|
allModules = defs: imap1 (n: { value, file }:
|
||||||
if isFunction value
|
if isAttrs value && shorthandOnlyDefinesConfig
|
||||||
then setFunctionArgs
|
then { _file = file; config = value; }
|
||||||
(args: lib.modules.unifyModuleSyntax file "${toString file}-${toString (n + extensionOffset)}" (value args))
|
else { _file = file; imports = [ value ]; }
|
||||||
(functionArgs value)
|
|
||||||
else if isAttrs value
|
|
||||||
then
|
|
||||||
lib.modules.unifyModuleSyntax file "${toString file}-${toString (n + extensionOffset)}" (shorthandToModule value)
|
|
||||||
else value
|
|
||||||
) defs;
|
) defs;
|
||||||
|
|
||||||
base = evalModules {
|
base = evalModules {
|
||||||
|
Loading…
Reference in New Issue
Block a user