diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-08-26 13:51:37 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-08-26 13:51:37 +0000 |
commit | 24487fa73ecab0b78aefd2e0a86ff90b14abf8ba (patch) | |
tree | 7881911c013603fe46589997ea288887486b35b5 | |
parent | 781a1122309b8939b6eb73184eb320fe852a7d0f (diff) |
* Allow the Nixpkgs config to be passed as a function argument (rather
than through ~/.nixpkgs/config.nix or $NIXPKGS_CONFIG). svn path=/nixpkgs/trunk/; revision=16861
-rw-r--r-- | pkgs/top-level/all-packages.nix | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3f857765753d5..407f9e47641cb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29,9 +29,15 @@ , gccWithCC ? true , gccWithProfiling ? true +, # Allow a configuration attribute set to be passed in as an + # argument. Otherwise, it's read from $NIXPKGS_CONFIG or + # ~/.nixpkgs/config.nix. + config ? null }: +let config_ = config; in # rename the function argument + let lib = import ../lib; # see also libTests below @@ -39,7 +45,7 @@ let # The contents of the configuration file found at $NIXPKGS_CONFIG or # $HOME/.nixpkgs/config.nix. config = - let { + let toPath = builtins.toPath; getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; pathExists = name: @@ -50,19 +56,18 @@ let configFile2 = homeDir + "/.nixpkgs/config.nix"; configExpr = - if configFile != "" && pathExists configFile - then import (toPath configFile) - else if homeDir != "" && pathExists configFile2 - then import (toPath configFile2) + if config_ != null then config_ + else if configFile != "" && pathExists configFile then import (toPath configFile) + else if homeDir != "" && pathExists configFile2 then import (toPath configFile2) else {}; + in # allow both: # { /* the config */ } and # { pkgsOrig, pkgs, ... } : { /* the config */ } - body = if builtins.isFunction configExpr + if builtins.isFunction configExpr then configExpr { inherit pkgs pkgsOrig; } else configExpr; - }; # Return an attribute from the Nixpkgs configuration file, or # a default value if the attribute doesn't exist. @@ -200,7 +205,7 @@ let allStdenvs = import ../stdenv { inherit system stdenvType; - allPackages = import ./all-packages.nix; + allPackages = args: import ./all-packages.nix ({ inherit config; } // args); }; defaultStdenv = allStdenvs.stdenv; @@ -1075,7 +1080,6 @@ let inherit fetchurl stdenv; }; - netpbm = import ../tools/graphics/netpbm { inherit stdenv fetchsvn libjpeg libpng zlib flex perl libxml2; }; |