From 7960a1b1b8fa1ca097bee2971fbbc18bda3dcadd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 Dec 2016 17:09:29 -0500 Subject: [PATCH] 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";