about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-25 14:08:29 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-25 14:08:29 +0000
commit671d53dd3543bf1e2bbc7b9784f3481a4922aa9f (patch)
tree8230338e021de4e331175a5832e17231c5209e7c /pkgs
parent5175cce9a948fbf4f31eaf1c1f630677c5844e1f (diff)
downloadnixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar.gz
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar.bz2
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar.lz
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar.xz
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.tar.zst
nixlib-671d53dd3543bf1e2bbc7b9784f3481a4922aa9f.zip
* Allow the user to install stdenv (nix-env -i stdenv) and get all the
  packages in the stdenv as propagated user environment packages.

svn path=/nixpkgs/branches/stdenv-updates/; revision=15300
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/lib/attrsets.nix6
-rw-r--r--pkgs/stdenv/generic/builder.sh5
-rw-r--r--pkgs/stdenv/generic/default.nix13
-rw-r--r--pkgs/stdenv/linux/default.nix5
4 files changed, 20 insertions, 9 deletions
diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix
index 3be143d6a217..1348a15bdba6 100644
--- a/pkgs/lib/attrsets.nix
+++ b/pkgs/lib/attrsets.nix
@@ -123,5 +123,9 @@ rec {
               else f (path ++ [name]) value;
         in mapAttrs g set;
     in recurse [] set;
-  
+
+
+  /* Check whether the argument is a derivation. */
+  isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
+
 }
diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh
index 16e232f586c6..23cc2a0775f5 100644
--- a/pkgs/stdenv/generic/builder.sh
+++ b/pkgs/stdenv/generic/builder.sh
@@ -30,3 +30,8 @@ sed \
     -e "s^@param4@^$p4^g" \
     -e "s^@param5@^$p5^g" \
     < "$setup" > "$out/setup"
+
+# Allow the user to install stdenv using nix-env and get the packages
+# in stdenv.
+mkdir $out/nix-support
+echo $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index cf3bbe7e5f66..1a1f588c16aa 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -7,7 +7,9 @@
   fetchurlBoot
 }:
 
-let {
+let
+
+  lib = import ../../lib;
 
   stdenvGenerator = setupScript: rec {
 
@@ -27,6 +29,9 @@ let {
 
         # TODO: make this more elegant.
         inherit param1 param2 param3 param4 param5;
+
+        propagatedUserEnvPkgs = [gcc] ++
+          lib.filter lib.isDerivation initialPath;
       }
 
       // {
@@ -79,7 +84,7 @@ let {
 
         # For convenience, bring in the library functions in lib/ so
         # packages don't have to do that themselves.
-        lib = import ../../lib;
+        inherit lib;
 
         inherit fetchurlBoot;
 
@@ -94,6 +99,4 @@ let {
   }.result;
 
   
-  body = stdenvGenerator ./setup.sh;
-
-}
+in stdenvGenerator ./setup.sh
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 757a475568f5..90444a96d76c 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -205,10 +205,9 @@ rec {
     
     preHook = builtins.toFile "prehook.sh" commonPreHook;
     
-    initialPath = [
+    initialPath = 
       ((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
-      stdenvLinuxBoot3Pkgs.patchelf
-    ];
+      ++ [stdenvLinuxBoot3Pkgs.patchelf];
 
     gcc = wrapGCC rec {
       inherit (stdenvLinuxBoot2Pkgs) binutils;