From a94af71da71ebc4a52c002891d813cf2689fc950 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 Dec 2016 16:43:38 -0500 Subject: [PATCH 1/4] linux stdenv: Fix assert that broke tests...and hydra --- pkgs/stdenv/linux/make-bootstrap-tools.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 7063d7bfcb6..26dfee25230 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -180,7 +180,7 @@ rec { allPackages = assert false; null; platform = assert false; null; - crossSystem = assert false; null; + crossSystem = null; config = assert false; null; }).bootstrapTools; From 670256dc399ab637fa94df9a90fb13f275c39f8a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 Dec 2016 17:05:39 -0500 Subject: [PATCH 2/4] linux stdenv: Rename the `bootstrap` directory to `bootstrap-files` --- .../{bootstrap => bootstrap-files}/armv5tel.nix | 0 .../linux/{bootstrap => bootstrap-files}/armv6l.nix | 0 .../linux/{bootstrap => bootstrap-files}/armv7l.nix | 0 .../linux/{bootstrap => bootstrap-files}/i686.nix | 0 .../{bootstrap => bootstrap-files}/loongson2f.nix | 0 .../linux/{bootstrap => bootstrap-files}/x86_64.nix | 0 pkgs/stdenv/linux/default.nix | 12 ++++++------ 7 files changed, 6 insertions(+), 6 deletions(-) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/armv5tel.nix (100%) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/armv6l.nix (100%) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/armv7l.nix (100%) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/i686.nix (100%) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/loongson2f.nix (100%) rename pkgs/stdenv/linux/{bootstrap => bootstrap-files}/x86_64.nix (100%) diff --git a/pkgs/stdenv/linux/bootstrap/armv5tel.nix b/pkgs/stdenv/linux/bootstrap-files/armv5tel.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/armv5tel.nix rename to pkgs/stdenv/linux/bootstrap-files/armv5tel.nix diff --git a/pkgs/stdenv/linux/bootstrap/armv6l.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/armv6l.nix rename to pkgs/stdenv/linux/bootstrap-files/armv6l.nix diff --git a/pkgs/stdenv/linux/bootstrap/armv7l.nix b/pkgs/stdenv/linux/bootstrap-files/armv7l.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/armv7l.nix rename to pkgs/stdenv/linux/bootstrap-files/armv7l.nix diff --git a/pkgs/stdenv/linux/bootstrap/i686.nix b/pkgs/stdenv/linux/bootstrap-files/i686.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/i686.nix rename to pkgs/stdenv/linux/bootstrap-files/i686.nix diff --git a/pkgs/stdenv/linux/bootstrap/loongson2f.nix b/pkgs/stdenv/linux/bootstrap-files/loongson2f.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/loongson2f.nix rename to pkgs/stdenv/linux/bootstrap-files/loongson2f.nix diff --git a/pkgs/stdenv/linux/bootstrap/x86_64.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64.nix similarity index 100% rename from pkgs/stdenv/linux/bootstrap/x86_64.nix rename to pkgs/stdenv/linux/bootstrap-files/x86_64.nix diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 34196359f52..a39ff61a8b5 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -7,12 +7,12 @@ , system, platform, crossSystem, config , bootstrapFiles ? - if system == "i686-linux" then import ./bootstrap/i686.nix - else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix - else if system == "armv5tel-linux" then import ./bootstrap/armv5tel.nix - else if system == "armv6l-linux" then import ./bootstrap/armv6l.nix - else if system == "armv7l-linux" then import ./bootstrap/armv7l.nix - else if system == "mips64el-linux" then import ./bootstrap/loongson2f.nix + if system == "i686-linux" then import ./bootstrap-files/i686.nix + else if system == "x86_64-linux" then import ./bootstrap-files/x86_64.nix + else if system == "armv5tel-linux" then import ./bootstrap-files/armv5tel.nix + else if system == "armv6l-linux" then import ./bootstrap-files/armv6l.nix + else if system == "armv7l-linux" then import ./bootstrap-files/armv7l.nix + else if system == "mips64el-linux" then import ./bootstrap-files/loongson2f.nix else abort "unsupported platform for the pure Linux stdenv" }: From 7960a1b1b8fa1ca097bee2971fbbc18bda3dcadd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 Dec 2016 17:09:29 -0500 Subject: [PATCH 3/4] linux stdenv: Avoid `assert false` On one hand, don't want to pass garbage that affects hash, on the other hand footguns are bad. Now, factored out the derivation so only need to pass in what is used. --- pkgs/stdenv/linux/bootstrap-tools/default.nix | 18 ++++++++++++++++++ .../scripts/unpack-bootstrap-tools.sh | 0 pkgs/stdenv/linux/default.nix | 17 +---------------- pkgs/stdenv/linux/make-bootstrap-tools.nix | 11 +---------- 4 files changed, 20 insertions(+), 26 deletions(-) create mode 100644 pkgs/stdenv/linux/bootstrap-tools/default.nix rename pkgs/stdenv/linux/{ => bootstrap-tools}/scripts/unpack-bootstrap-tools.sh (100%) diff --git a/pkgs/stdenv/linux/bootstrap-tools/default.nix b/pkgs/stdenv/linux/bootstrap-tools/default.nix new file mode 100644 index 00000000000..6118585d545 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap-tools/default.nix @@ -0,0 +1,18 @@ +{ system, bootstrapFiles }: + +derivation { + name = "bootstrap-tools"; + + builder = bootstrapFiles.busybox; + + args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ]; + + tarball = bootstrapFiles.bootstrapTools; + + inherit system; + + # Needed by the GCC wrapper. + langC = true; + langCC = true; + isGNU = true; +} diff --git a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh similarity index 100% rename from pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh rename to pkgs/stdenv/linux/bootstrap-tools/scripts/unpack-bootstrap-tools.sh diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index a39ff61a8b5..9900fc6dd3d 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -37,22 +37,7 @@ rec { # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). - bootstrapTools = derivation { - name = "bootstrap-tools"; - - builder = bootstrapFiles.busybox; - - args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ]; - - tarball = bootstrapFiles.bootstrapTools; - - inherit system; - - # Needed by the GCC wrapper. - langC = true; - langCC = true; - isGNU = true; - }; + bootstrapTools = import ./bootstrap-tools { inherit system bootstrapFiles; }; # This function builds the various standard environments used during diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 26dfee25230..e13fb88eff0 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -173,16 +173,7 @@ rec { bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz"; }; - bootstrapTools = (import ./default.nix { - inherit system bootstrapFiles; - - lib = assert false; null; - allPackages = assert false; null; - - platform = assert false; null; - crossSystem = null; - config = assert false; null; - }).bootstrapTools; + bootstrapTools = import ./bootstrap-tools { inherit system bootstrapFiles; }; test = derivation { name = "test-bootstrap-tools"; From 19fbe80c3d1f3b5888a3f78f2df2af07355ea498 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 Dec 2016 17:09:46 -0500 Subject: [PATCH 4/4] top-level: avoid another `assert false` while we're at it --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 2 +- pkgs/top-level/default.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index bd581f71a43..c862eb141a8 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -334,7 +334,7 @@ in rec { # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it test-pkgs = import test-pkgspath { inherit system; - stdenv = args: let + stdenvFunc = args: let args' = args // { inherit bootstrapFiles; }; in (import (test-pkgspath + "/pkgs/stdenv/darwin") args').stdenvDarwin; }; diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 31c51215676..658f149908c 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -25,7 +25,7 @@ , # The standard environment for building packages, or rather a function # providing it. See below for the arguments given to that function. - stdenv ? assert false; null + stdenvFunc ? import ../stdenv , crossSystem ? null , platform ? assert false; null @@ -76,7 +76,7 @@ in let inherit lib nixpkgsFun; } // newArgs); - stdenv = (args.stdenv or (import ../stdenv)) { + stdenv = stdenvFunc { inherit lib allPackages system platform crossSystem config; };