summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2015-06-06 22:38:08 +0000
committerDan Peebles <pumpkin@me.com>2015-06-08 01:55:49 +0000
commitb13cb5461433ccf7ae1a2e8d2691c3111441e984 (patch)
treeb53923944406959f21125ab79356c1c3c26212ea /lib/modules.nix
parent514a9fdf878a65bca0e329cbb733070f3bd0ab0f (diff)
downloadnixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar.gz
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar.bz2
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar.lz
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar.xz
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.tar.zst
nixpkgs-b13cb5461433ccf7ae1a2e8d2691c3111441e984.zip
Bring an importable modulesPath back from the dead, in the only way I know
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index dcede0c46c6..3561dd0d1d3 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -17,6 +17,10 @@ rec {
      evalModules) and the less declarative the module set is. */
   evalModules = { modules
                 , prefix ? []
+                , # This should only be used for special arguments that need to be evaluated
+                  # when resolving module structure (like in imports). For everything else,
+                  # there's _module.args.
+                  specialArgs ? {}
                 , # This would be remove in the future, Prefer _module.args option instead.
                   args ? {}
                 , # This would be remove in the future, Prefer _module.check option instead.
@@ -51,7 +55,7 @@ rec {
         };
       };
 
-      closed = closeModules (modules ++ [ internalModule ]) { inherit config options; lib = import ./.; };
+      closed = closeModules (modules ++ [ internalModule ]) (specialArgs // { inherit config options; lib = import ./.; });
 
       # Note: the list of modules is reversed to maintain backward
       # compatibility with the old module system.  Not sure if this is
@@ -118,7 +122,7 @@ rec {
         config = removeAttrs m ["key" "_file" "require" "imports"];
       };
 
-  applyIfFunction = f: arg@{ config, options, lib }: if isFunction f then
+  applyIfFunction = f: arg@{ config, options, lib, ... }: if isFunction f then
     let
       # Module arguments are resolved in a strict manner when attribute set
       # deconstruction is used.  As the arguments are now defined with the