mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
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:
|
||||
let
|
||||
moduleImport = m:
|
||||
@ -189,16 +199,11 @@ rec {
|
||||
options = lib.zip (name: values:
|
||||
if any isOption values then
|
||||
let
|
||||
# locations to sub-options declarations
|
||||
decls =
|
||||
decls = # add location to sub-module options.
|
||||
map (m:
|
||||
mapSubOptions (subModule: (args:
|
||||
let module = lib.applyIfFunction subModule args; in
|
||||
if lib.isModule module then
|
||||
{ inherit (m) key; } // module
|
||||
else
|
||||
{ inherit (m) key; options = module; }
|
||||
)) m.options
|
||||
mapSubOptions
|
||||
(unifyOptionModule {inherit (m) key;})
|
||||
m.options
|
||||
) (declarationsOf name);
|
||||
in
|
||||
addOptionMakeUp
|
||||
|
Loading…
Reference in New Issue
Block a user