summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-02-09 17:04:18 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-02-09 17:04:18 +0000
commit07bc3fbf002a802c5e0c57c9700c4c8b693ff212 (patch)
treebc6b7594a3de4b53fd7e23181d6fd709e938ac4e /pkgs/stdenv
parent29c64c6c6768ea1594a85d1544ee9c64a16d534e (diff)
downloadnixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar.gz
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar.bz2
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar.lz
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar.xz
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.tar.zst
nixpkgs-07bc3fbf002a802c5e0c57c9700c4c8b693ff212.zip
* Push packages from the final stdenv bootstrapping phase to
  all-packages.  That is, an attribute like "bash" in all-packages.nix
  should evaluate to the "bash" used to build stdenv, it shouldn't
  build a new one.

  Hm, this would be a lot cleaner if we had lazy_rec ;-)

svn path=/nixpkgs/branches/usability/; revision=4775
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/default.nix11
-rw-r--r--pkgs/stdenv/linux/default.nix60
2 files changed, 39 insertions, 32 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index b25703eb9af..5bb63f1b815 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -1,5 +1,6 @@
 { stdenv, name, preHook ? null, postHook ? null, initialPath, gcc, shell
 , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
+, extraAttrs ? {}
 }:
 
 let {
@@ -24,6 +25,7 @@ let {
     # Add a utility function to produce derivations that use this
     # stdenv and its shell.
     // {
+    
       mkDerivation = attrs: derivation (attrs // {
         builder = if attrs ? realBuilder then attrs.realBuilder else shell;
         args = if attrs ? args then attrs.args else
@@ -31,6 +33,13 @@ let {
         stdenv = body;
         system = body.system;
       });
-    };
+
+    }
+
+    # Propagate any extra attributes.  For instance, we use this to
+    # "lift" packages like curl from the final stdenv for Linux to
+    # all-packages.nix for that platform (meaning that it has a line
+    # like curl = if stdenv ? curl then stdenv.curl else ...).
+    // extraAttrs;
 
 }
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index c5b05a1f198..3fc3c16e01f 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -114,22 +114,26 @@ rec {
 
   # This function builds the various standard environments used during
   # the bootstrap.
-  stdenvBootFun = {glibc, gcc, binutils, staticGlibc}: (import ../generic) {
-    name = "stdenv-linux-boot";
-    param1 = if staticGlibc then "static" else "dynamic";
-    preHook = ./prehook.sh;
-    stdenv = stdenvInitial;
-    shell = ./tools/bash;
-    gcc = (import ../../build-support/gcc-wrapper) {
+  stdenvBootFun =
+    {glibc, gcc, binutils, staticGlibc, extraAttrs ? {}}:
+    
+    import ../generic {
+      name = "stdenv-linux-boot";
+      param1 = if staticGlibc then "static" else "dynamic";
+      preHook = ./prehook.sh;
       stdenv = stdenvInitial;
-      nativeTools = false;
-      nativeGlibc = false;
-      inherit gcc glibc binutils;
+      shell = ./tools/bash;
+      gcc = (import ../../build-support/gcc-wrapper) {
+        stdenv = stdenvInitial;
+        nativeTools = false;
+        nativeGlibc = false;
+        inherit gcc glibc binutils;
+      };
+      initialPath = [
+        staticTools
+      ];
+      inherit extraAttrs;
     };
-    initialPath = [
-      staticTools
-    ];
-  };
 
 
   # Create the first "real" standard environment.  This one consists
@@ -139,13 +143,13 @@ rec {
     # Use the statically linked, downloaded glibc/gcc/binutils.
     inherit glibc gcc binutils;
     staticGlibc = true;
+    extraAttrs = {inherit curl;};
   };
 
   # 2) These are the packages that we can build with the first
   #    stdenv.  We only need Glibc (in step 3).
   stdenvLinuxBoot1Pkgs = allPackages {
     bootStdenv = stdenvLinuxBoot1;
-#    bootCurl = curl;
   };
 
   # 3) Build Glibc with the statically linked tools.  The result is the
@@ -159,12 +163,12 @@ rec {
     glibc = stdenvLinuxGlibc;
     staticGlibc = false;
     inherit gcc binutils;
+    extraAttrs = {inherit curl;};
   };
 
   # 5) The packages that can be built using the second stdenv.
   stdenvLinuxBoot2Pkgs = allPackages {
     bootStdenv = stdenvLinuxBoot2;
-#    bootCurl = curl;
   };
 
   # 6) Construct a third stdenv identical to the second, except that
@@ -174,12 +178,12 @@ rec {
     glibc = stdenvLinuxGlibc;
     staticGlibc = false;
     inherit (stdenvLinuxBoot2Pkgs) gcc binutils;
+    extraAttrs = {inherit curl;};
   };
 
   # 7) The packages that can be built using the third stdenv.
   stdenvLinuxBoot3Pkgs = allPackages {
     bootStdenv = stdenvLinuxBoot3;
-#    bootCurl = curl;
   };
 
   # 8) Construct the final stdenv.  It uses the Glibc, GCC and
@@ -205,20 +209,14 @@ rec {
     };
 
     shell = stdenvLinuxBoot3Pkgs.bash ~ /bin/sh;
+    
+    extraAttrs = {
+      curl = stdenvLinuxBoot3Pkgs.realCurl;
+      inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */;
+      inherit (stdenvLinuxBoot3Pkgs)
+        gzip bzip2 bash coreutils diffutils findutils gawk
+        gnumake gnused gnutar gnugrep patch patchelf;
+    };
   };
 
-  # 8) Finally, the set of components built using the Linux stdenv.
-  #    Reuse the tools built in the previous steps.
-  stdenvLinuxPkgs =
-    allPackages {
-      bootStdenv = stdenvLinux;
-#      bootCurl = stdenvLinuxBoot3Pkgs.curl;
-    } //
-    {inherit (stdenvLinuxBoot2Pkgs) binutils gcc;} //
-    {inherit (stdenvLinuxBoot3Pkgs)
-      gzip bzip2 bash coreutils diffutils findutils gawk
-      gnumake gnused gnutar gnugrep curl patch patchelf;
-    } //
-    {glibc = stdenvLinuxGlibc;};
-    
 }