refactor stdenvs.nix to use all the right tools at the right time

svn path=/nixpkgs/branches/nixos-pkgs/; revision=1870
This commit is contained in:
Armijn Hemel 2004-12-15 15:42:48 +00:00
parent d6702d185a
commit f9743cec5a

View File

@ -53,7 +53,10 @@
# environment, that is, it should contain no external references. # environment, that is, it should contain no external references.
# 0) ... # 0) ...
stdenvLinuxBoot0 = (import ../stdenv/nix-linux-static).stdenvBoot; stdenvLinuxBoot0 = (import ../stdenv/nix-linux-static).stdenvBootFun {
# Use the statically linked, downloaded glibc/gcc/binutils.
inherit (import ../stdenv/nix-linux-static) glibc gcc binutils;
};
stdenvLinuxBoot0Pkgs = allPackages { stdenvLinuxBoot0Pkgs = allPackages {
stdenv = stdenvLinuxBoot0; stdenv = stdenvLinuxBoot0;
@ -72,7 +75,10 @@
# prevent impurity in the things it builds (e.g., through # prevent impurity in the things it builds (e.g., through
# `-lncurses'). # `-lncurses').
stdenvLinuxBoot1 = (import ../stdenv/nix-linux-static).stdenvBootFun { stdenvLinuxBoot1 = (import ../stdenv/nix-linux-static).stdenvBootFun {
# Use the statically linked, downloaded gcc/binutils, but the
# glibc we just built.
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
inherit (import ../stdenv/nix-linux-static) gcc binutils;
}; };
# 3) Now we can build packages that will link against the Nix # 3) Now we can build packages that will link against the Nix
@ -83,33 +89,31 @@
stdenvLinuxBoot1Pkgs = allPackages { stdenvLinuxBoot1Pkgs = allPackages {
stdenv = stdenvLinuxBoot1; stdenv = stdenvLinuxBoot1;
bootCurl = (import ../stdenv/nix-linux-static).curl; bootCurl = (import ../stdenv/nix-linux-static).curl;
noSysDirs = true;
}; };
# 4) Therefore we build a new standard environment which is the same # 4) Therefore we build a new standard environment which is the same
# as the one in step 2, but with a gcc and binutils from step 3 # as the one in step 2, but with a gcc and binutils from step 3
# merged in. Since these are pure (they don't search native # merged in. Since these are pure (they don't search native
# system directories), things built by this stdenv should be pure. # system directories), things built by this stdenv should be pure.
stdenvLinuxBoot2 = (import ../stdenv/nix-linux) { stdenvLinuxBoot2 = (import ../stdenv/nix-linux-static).stdenvBootFun {
stdenv = stdenvLinuxBoot1; # Use the glibc/gcc/binutils we just built (but all other tools are still downloaded).
pkgs = stdenvLinuxBoot0Pkgs // {
inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
};
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
inherit genericStdenv gccWrapper; inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
}; };
# 5) So these packages should be pure. # 5) So these packages should be pure.
stdenvLinuxBoot2Pkgs = allPackages { stdenvLinuxBoot2Pkgs = allPackages {
stdenv = stdenvLinuxBoot2; stdenv = stdenvLinuxBoot2;
bootCurl = stdenvLinuxBoot0Pkgs.curl; bootCurl = (import ../stdenv/nix-linux-static).curl;
}; };
# 6) Finally we can construct the Nix build environment from the # 6) Finally we can construct the Nix build environment from the
# packages from step 5. # packages from step 5.
stdenvLinux = (import ../stdenv/nix-linux) { stdenvLinux = (import ../stdenv/nix-linux) {
stdenv = stdenvLinuxBoot2; stdenv = stdenvLinuxBoot2;
pkgs = stdenvLinuxBoot2Pkgs; pkgs = stdenvLinuxBoot2Pkgs // {
inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
};
glibc = stdenvLinuxGlibc; glibc = stdenvLinuxGlibc;
inherit genericStdenv gccWrapper; inherit genericStdenv gccWrapper;
}; };