extract function unifyOptionModule from moduleMerge. This function is
used to convert option sets, provided inside option declarations, to a module. svn path=/nixpkgs/trunk/; revision=17735
This commit is contained in:
parent
67bf96d424
commit
fd0396037a
|
@ -68,6 +68,16 @@ rec {
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
unifyOptionModule = {key ? "<unknown location>"}: m: (args:
|
||||||
|
let module = lib.applyIfFunction m args; in
|
||||||
|
if lib.isModule module then
|
||||||
|
{ inherit key; } // module
|
||||||
|
else
|
||||||
|
{ inherit key; options = module; }
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
moduleClosure = initModules: args:
|
moduleClosure = initModules: args:
|
||||||
let
|
let
|
||||||
moduleImport = m:
|
moduleImport = m:
|
||||||
|
@ -189,16 +199,11 @@ rec {
|
||||||
options = lib.zip (name: values:
|
options = lib.zip (name: values:
|
||||||
if any isOption values then
|
if any isOption values then
|
||||||
let
|
let
|
||||||
# locations to sub-options declarations
|
decls = # add location to sub-module options.
|
||||||
decls =
|
|
||||||
map (m:
|
map (m:
|
||||||
mapSubOptions (subModule: (args:
|
mapSubOptions
|
||||||
let module = lib.applyIfFunction subModule args; in
|
(unifyOptionModule {inherit (m) key;})
|
||||||
if lib.isModule module then
|
m.options
|
||||||
{ inherit (m) key; } // module
|
|
||||||
else
|
|
||||||
{ inherit (m) key; options = module; }
|
|
||||||
)) m.options
|
|
||||||
) (declarationsOf name);
|
) (declarationsOf name);
|
||||||
in
|
in
|
||||||
addOptionMakeUp
|
addOptionMakeUp
|
||||||
|
|
Loading…
Reference in New Issue