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