summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorGergely Risko <errge@nilcons.com>2014-08-23 20:34:01 +0200
committerGergely Risko <errge@nilcons.com>2014-08-24 17:10:05 +0200
commit8a445f923710ff1a4885c268a16cb931e3b639f0 (patch)
treef8fc27c7d35c1bc0fdff028ad7085f4871522c30 /pkgs/stdenv
parent0df6ccb4b61892954dc222f0c34a3b3b7f52bc24 (diff)
downloadnixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar.gz
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar.bz2
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar.lz
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar.xz
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.tar.zst
nixlib-8a445f923710ff1a4885c268a16cb931e3b639f0.zip
Refactor fetchurl handling in stdenvLinux
All the different stages of stdenv had the fetchurl inherited anyways,
so make this generic in stdenvBootFun.

This commit doesn't change the outhash (or drvhash) of the stdenv.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/linux/default.nix29
1 files changed, 10 insertions, 19 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 23cccf223f4f..71b23a396d9a 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -46,7 +46,7 @@ rec {
     builder = bootstrapFiles.sh;
 
     args =
-      if system == "armv5tel-linux" || system == "armv6l-linux" 
+      if system == "armv5tel-linux" || system == "armv6l-linux"
         || system == "armv7l-linux"
       then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
       else [ ./scripts/unpack-bootstrap-tools.sh ];
@@ -69,9 +69,9 @@ rec {
   # This function builds the various standard environments used during
   # the bootstrap.
   stdenvBootFun =
-    {gcc, extraAttrs ? {}, overrides ? (pkgs: {}), extraPath ? [], fetchurl}:
+    {gcc, extraAttrs ? {}, overrides ? (pkgs: {}), extraPath ? []}:
 
-    import ../generic {
+    let thisStdenv = import ../generic {
       inherit system config;
       name = "stdenv-linux-boot";
       preHook =
@@ -83,27 +83,22 @@ rec {
         '';
       shell = "${bootstrapTools}/bin/sh";
       initialPath = [bootstrapTools] ++ extraPath;
-      fetchurlBoot = fetchurl;
+      fetchurlBoot = import ../../build-support/fetchurl {
+        stdenv = stdenvLinuxBoot0;
+        curl = bootstrapTools;
+      };
       inherit gcc;
       # Having the proper 'platform' in all the stdenvs allows getting proper
       # linuxHeaders for example.
       extraAttrs = extraAttrs // { inherit platform; };
-      overrides = pkgs: (overrides pkgs) // {
-        inherit fetchurl;
-      };
+      overrides = pkgs: (overrides pkgs) // { fetchurl = thisStdenv.fetchurlBoot; };
     };
+    in thisStdenv;
 
   # Build a dummy stdenv with no GCC or working fetchurl.  This is
   # because we need a stdenv to build the GCC wrapper and fetchurl.
   stdenvLinuxBoot0 = stdenvBootFun {
     gcc = "/no-such-path";
-    fetchurl = null;
-  };
-
-
-  fetchurl = import ../../build-support/fetchurl {
-    stdenv = stdenvLinuxBoot0;
-    curl = bootstrapTools;
   };
 
 
@@ -142,7 +137,6 @@ rec {
       binutils = bootstrapTools;
       coreutils = bootstrapTools;
     };
-    inherit fetchurl;
   };
 
 
@@ -168,7 +162,6 @@ rec {
     overrides = pkgs: {
       inherit (stdenvLinuxBoot1Pkgs) perl;
     };
-    inherit fetchurl;
   };
 
 
@@ -211,7 +204,6 @@ rec {
       glibc = stdenvLinuxGlibc;   # Required by gcc47 build
     };
     extraPath = [ stdenvLinuxBoot1Pkgs.paxctl ];
-    inherit fetchurl;
   };
 
 
@@ -238,7 +230,6 @@ rec {
       inherit (stdenvLinuxBoot1Pkgs) perl;
       inherit (stdenvLinuxBoot3Pkgs) gettext gnum4 gmp;
     };
-    inherit fetchurl;
   };
 
 
@@ -281,7 +272,7 @@ rec {
 
     shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash";
 
-    fetchurlBoot = fetchurl;
+    fetchurlBoot = stdenvLinuxBoot0.fetchurlBoot;
 
     extraAttrs = {
       inherit (stdenvLinuxBoot3Pkgs) glibc;