summary refs log tree commit diff
path: root/pkgs/lib/modules.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-30 12:56:18 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-12-03 20:48:52 +0100
commitabd06b220d4424faea198f0c302b2cdff10c1d0a (patch)
tree211af201cfe62888fb6314838955bc5fdac4be43 /pkgs/lib/modules.nix
parent6655cf6d23c7046613a55317ecd38f91c8ab27d2 (diff)
downloadnixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar.gz
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar.bz2
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar.lz
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar.xz
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.tar.zst
nixpkgs-abd06b220d4424faea198f0c302b2cdff10c1d0a.zip
Remove unused function ‘selectDeclsAndDefs’
Diffstat (limited to 'pkgs/lib/modules.nix')
-rw-r--r--pkgs/lib/modules.nix27
1 files changed, 14 insertions, 13 deletions
diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix
index 25cb956a0ea..31ac1c04fb2 100644
--- a/pkgs/lib/modules.nix
+++ b/pkgs/lib/modules.nix
@@ -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