diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 6c369c65841a..c5b05a1f198e 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -144,8 +144,8 @@ rec { # 2) These are the packages that we can build with the first # stdenv. We only need Glibc (in step 3). stdenvLinuxBoot1Pkgs = allPackages { - stdenv = stdenvLinuxBoot1; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot1; +# bootCurl = curl; }; # 3) Build Glibc with the statically linked tools. The result is the @@ -163,8 +163,8 @@ rec { # 5) The packages that can be built using the second stdenv. stdenvLinuxBoot2Pkgs = allPackages { - stdenv = stdenvLinuxBoot2; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot2; +# bootCurl = curl; }; # 6) Construct a third stdenv identical to the second, except that @@ -178,8 +178,8 @@ rec { # 7) The packages that can be built using the third stdenv. stdenvLinuxBoot3Pkgs = allPackages { - stdenv = stdenvLinuxBoot3; - bootCurl = curl; + bootStdenv = stdenvLinuxBoot3; +# bootCurl = curl; }; # 8) Construct the final stdenv. It uses the Glibc, GCC and @@ -211,8 +211,8 @@ rec { # Reuse the tools built in the previous steps. stdenvLinuxPkgs = allPackages { - stdenv = stdenvLinux; - bootCurl = stdenvLinuxBoot3Pkgs.curl; + bootStdenv = stdenvLinux; +# bootCurl = stdenvLinuxBoot3Pkgs.curl; } // {inherit (stdenvLinuxBoot2Pkgs) binutils gcc;} // {inherit (stdenvLinuxBoot3Pkgs) diff --git a/pkgs/top-level/all-packages-generic.nix b/pkgs/top-level/all-packages-generic.nix index fe11dd3d10b9..9b66aacdacc6 100644 --- a/pkgs/top-level/all-packages-generic.nix +++ b/pkgs/top-level/all-packages-generic.nix @@ -1,17 +1,27 @@ -# This file evaluates to a function that, when supplied with a system -# identifier and a standard build environment, returns the set of all -# packages provided by the Nix Package Collection. +/* This file composes the Nix Packages collection. That is, it + imports the functions that build the various packages, and calls + them with appropriate arguments. The result is a set of all the + packages in the Nix Packages collection for some particular + platform. */ + -{ stdenv, bootCurl, noSysDirs ? true +{ # The system for which to build the packages. + system ? __currentSystem + +, # The standard environment to use. Only used for bootstrapping. If + # null, the default standard environment is used. + bootStdenv ? null + + # More flags for the bootstrapping of stdenv. +, noSysDirs ? true , gccWithCC ? true , gccWithProfiling ? true + }: + rec { - inherit stdenv; - - ### Symbolic names. useOldXLibs = false; @@ -25,6 +35,19 @@ rec { # `xlibs.xlibs' is a wrapper packages that combines libX11 and a bunch # of other basic X client libraries. x11 = if useOldXLibs then xlibsOld.xlibs else xlibsWrapper; + + + ### STANDARD ENVIRONMENT + + stdenv = if bootStdenv == null then defaultStdenv else bootStdenv; + + defaultStdenv = + (import ./stdenvs.nix { + inherit system; + allPackages = import ./all-packages-generic.nix; + }).stdenv; + + bootCurl = null; ### BUILD SUPPORT diff --git a/pkgs/top-level/stdenvs.nix b/pkgs/top-level/stdenvs.nix index b96c3d17674c..fe25421b8044 100644 --- a/pkgs/top-level/stdenvs.nix +++ b/pkgs/top-level/stdenvs.nix @@ -5,7 +5,9 @@ # Posix utilities, the GNU C compiler, and so on. On other systems, # we use the native C library. -{system, allPackages}: rec { +{system, allPackages}: + +rec { gccWrapper = import ../build-support/gcc-wrapper; genericStdenv = import ../stdenv/generic; @@ -29,8 +31,7 @@ }; stdenvNativePkgs = allPackages { - stdenv = stdenvNative; - bootCurl = null; + bootStdenv = stdenvNative; noSysDirs = false; }; @@ -43,8 +44,7 @@ }; stdenvNixPkgs = allPackages { - stdenv = stdenvNix; - bootCurl = stdenvNativePkgs.curl; + bootStdenv = stdenvNix; noSysDirs = false; }; @@ -62,8 +62,7 @@ }; stdenvDarwinPkgs = allPackages { - stdenv = stdenvDarwin; - bootCurl = null; + bootStdenv = stdenvDarwin; noSysDirs = false; }; @@ -77,15 +76,15 @@ }; stdenvFreeBSDPkgs = allPackages { - stdenv = stdenvFreeBSD; - bootCurl = null; + bootStdenv = stdenvFreeBSD; noSysDirs = false; }; - stdenvTestPkgs = allPackages { - stdenv = (import ../stdenv/nix-linux-static).stdenvInitial; - bootCurl = (import ../stdenv/nix-linux-static).curl; - noSysDirs = true; - }; + # Select the appropriate stdenv for the platform `system'. + stdenv = + if system == "i686-linux" then stdenvLinux + else if system == "i686-freebsd" then stdenvFreeBSD + else if system == "powerpc-darwin" then stdenvDarwin + else stdenvNative; }