Remove unused function ‘selectDeclsAndDefs’
This commit is contained in:
parent
6655cf6d23
commit
abd06b220d
|
@ -21,22 +21,26 @@ rec {
|
||||||
|| builtins.isList x
|
|| builtins.isList x
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
importIfPath = path:
|
importIfPath = path:
|
||||||
if isPath path then
|
if isPath path then
|
||||||
import path
|
import path
|
||||||
else
|
else
|
||||||
path;
|
path;
|
||||||
|
|
||||||
|
|
||||||
applyIfFunction = f: arg:
|
applyIfFunction = f: arg:
|
||||||
if builtins.isFunction f then
|
if builtins.isFunction f then
|
||||||
f arg
|
f arg
|
||||||
else
|
else
|
||||||
f;
|
f;
|
||||||
|
|
||||||
|
|
||||||
isModule = m:
|
isModule = m:
|
||||||
(m ? config && isAttrs m.config && ! isOption m.config)
|
(m ? config && isAttrs m.config && ! isOption m.config)
|
||||||
|| (m ? options && isAttrs m.options && ! isOption m.options);
|
|| (m ? options && isAttrs m.options && ! isOption m.options);
|
||||||
|
|
||||||
|
|
||||||
# Convert module to a set which has imports / options and config
|
# Convert module to a set which has imports / options and config
|
||||||
# attributes.
|
# attributes.
|
||||||
unifyModuleSyntax = m:
|
unifyModuleSyntax = m:
|
||||||
|
@ -107,15 +111,6 @@ rec {
|
||||||
operator = m: imap (moduleImport m) (getImports m);
|
operator = m: imap (moduleImport m) (getImports m);
|
||||||
});
|
});
|
||||||
|
|
||||||
selectDeclsAndDefs = modules:
|
|
||||||
lib.concatMap (m:
|
|
||||||
if m ? config || m ? options then
|
|
||||||
[ (m.options or {}) ]
|
|
||||||
++ [ (m.config or {}) ]
|
|
||||||
else
|
|
||||||
[ m ]
|
|
||||||
) modules;
|
|
||||||
|
|
||||||
|
|
||||||
moduleApply = funs: module:
|
moduleApply = funs: module:
|
||||||
lib.mapAttrs (name: value:
|
lib.mapAttrs (name: value:
|
||||||
|
@ -126,6 +121,7 @@ rec {
|
||||||
value
|
value
|
||||||
) module;
|
) module;
|
||||||
|
|
||||||
|
|
||||||
# Handle mkMerge function left behind after a delay property.
|
# Handle mkMerge function left behind after a delay property.
|
||||||
moduleFlattenMerge = module:
|
moduleFlattenMerge = module:
|
||||||
if module ? config &&
|
if module ? config &&
|
||||||
|
@ -137,6 +133,7 @@ rec {
|
||||||
else
|
else
|
||||||
[ module ];
|
[ module ];
|
||||||
|
|
||||||
|
|
||||||
# Handle mkMerge attributes which are left behind by previous delay
|
# Handle mkMerge attributes which are left behind by previous delay
|
||||||
# properties and convert them into a list of modules. Delay properties
|
# properties and convert them into a list of modules. Delay properties
|
||||||
# inside the config attribute of a module and create a second module if a
|
# inside the config attribute of a module and create a second module if a
|
||||||
|
@ -146,6 +143,7 @@ rec {
|
||||||
delayModule = module:
|
delayModule = module:
|
||||||
map (moduleApply { config = delayProperties; }) (moduleFlattenMerge module);
|
map (moduleApply { config = delayProperties; }) (moduleFlattenMerge module);
|
||||||
|
|
||||||
|
|
||||||
evalDefinitions = opt: values:
|
evalDefinitions = opt: values:
|
||||||
if opt ? type && opt.type.delayOnGlobalEval then
|
if opt ? type && opt.type.delayOnGlobalEval then
|
||||||
map (delayPropertiesWithIter opt.type.iter opt.name)
|
map (delayPropertiesWithIter opt.type.iter opt.name)
|
||||||
|
@ -171,17 +169,20 @@ rec {
|
||||||
map (selectModule name) modules
|
map (selectModule name) modules
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
modulesNames = modules:
|
modulesNames = modules:
|
||||||
lib.concatMap (m: []
|
lib.concatMap (m: []
|
||||||
++ optionals (m ? options) (lib.attrNames m.options)
|
++ optionals (m ? options) (lib.attrNames m.options)
|
||||||
++ optionals (m ? config) (lib.attrNames m.config)
|
++ optionals (m ? config) (lib.attrNames m.config)
|
||||||
) modules;
|
) modules;
|
||||||
|
|
||||||
|
|
||||||
moduleZip = funs: modules:
|
moduleZip = funs: modules:
|
||||||
lib.mapAttrs (name: fun:
|
lib.mapAttrs (name: fun:
|
||||||
fun (catAttrs name modules)
|
fun (catAttrs name modules)
|
||||||
) funs;
|
) funs;
|
||||||
|
|
||||||
|
|
||||||
moduleMerge = path: modules:
|
moduleMerge = path: modules:
|
||||||
let modules_ = modules; in
|
let modules_ = modules; in
|
||||||
let
|
let
|
||||||
|
@ -342,16 +343,16 @@ rec {
|
||||||
|
|
||||||
fixMergeModules = initModules: {...}@args:
|
fixMergeModules = initModules: {...}@args:
|
||||||
lib.fix (result:
|
lib.fix (result:
|
||||||
# This trick avoid an infinite loop because names of attribute are
|
# This trick avoids an infinite loop because names of attribute
|
||||||
# know and it is not require to evaluate the result of moduleMerge to
|
# are know and it is not required to evaluate the result of
|
||||||
# know which attribute are present as argument.
|
# moduleMerge to know which attributes are present as arguments.
|
||||||
let module = { inherit (result) options config; }; in
|
let module = { inherit (result) options config; }; in
|
||||||
|
|
||||||
moduleMerge "" (
|
moduleMerge "" (
|
||||||
moduleClosure initModules (module // args)
|
moduleClosure initModules (module // args)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# Visit all definitions to raise errors related to undeclared options.
|
# Visit all definitions to raise errors related to undeclared options.
|
||||||
checkModule = path: {config, options, ...}@m:
|
checkModule = path: {config, options, ...}@m:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue