|
|
|
@ -334,6 +334,10 @@ rec { |
|
|
|
|
in modulesPath: initialModules: args: |
|
|
|
|
filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args); |
|
|
|
|
|
|
|
|
|
/* Wrap a module with a default location for reporting errors. */ |
|
|
|
|
setDefaultModuleLocation = file: m: |
|
|
|
|
{ _file = file; imports = [ m ]; }; |
|
|
|
|
|
|
|
|
|
/* Massage a module into canonical form, that is, a set consisting |
|
|
|
|
of ‘options’, ‘config’ and ‘imports’ attributes. */ |
|
|
|
|
unifyModuleSyntax = file: key: m: |
|
|
|
@ -534,11 +538,9 @@ rec { |
|
|
|
|
correspond to the definition of 'loc' in 'opt.file'. */ |
|
|
|
|
mergeOptionDecls = |
|
|
|
|
let |
|
|
|
|
packSubmodule = file: m: |
|
|
|
|
{ _file = file; imports = [ m ]; }; |
|
|
|
|
coerceOption = file: opt: |
|
|
|
|
if isFunction opt then packSubmodule file opt |
|
|
|
|
else packSubmodule file { options = opt; }; |
|
|
|
|
if isFunction opt then setDefaultModuleLocation file opt |
|
|
|
|
else setDefaultModuleLocation file { options = opt; }; |
|
|
|
|
in loc: opts: |
|
|
|
|
foldl' (res: opt: |
|
|
|
|
let t = res.type; |
|
|
|
@ -568,7 +570,7 @@ rec { |
|
|
|
|
|
|
|
|
|
getSubModules = opt.options.type.getSubModules or null; |
|
|
|
|
submodules = |
|
|
|
|
if getSubModules != null then map (packSubmodule opt._file) getSubModules ++ res.options |
|
|
|
|
if getSubModules != null then map (setDefaultModuleLocation opt._file) getSubModules ++ res.options |
|
|
|
|
else if opt.options ? options then map (coerceOption opt._file) options' ++ res.options |
|
|
|
|
else res.options; |
|
|
|
|
in opt.options // res // |
|
|
|
|