From 5c6234a7d3f0b430d7dc941dc1ab059c42729611 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 3 Dec 2016 17:21:07 -0800 Subject: [PATCH] top-level: Allow manually specifying a stdenv, and fix stdenv tests - The darwin test can now force the use of the freshly-booted darwin stdenv - The linux test now passes enough dummy arguments This may make debugging harder, if so, check out #20889 --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 8 ++++---- pkgs/stdenv/linux/make-bootstrap-tools.nix | 7 +++++++ pkgs/top-level/default.nix | 6 +++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 10d2b4decddd..bd581f71a436 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -332,10 +332,10 @@ in rec { }; # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it - test-pkgs = let - stdenv = import (test-pkgspath + "/pkgs/stdenv/darwin") { inherit system bootstrapFiles; }; - in import test-pkgspath { + test-pkgs = import test-pkgspath { inherit system; - bootStdenv = stdenv.stdenvDarwin; + stdenv = args: let + args' = args // { inherit bootstrapFiles; }; + in (import (test-pkgspath + "/pkgs/stdenv/darwin") args').stdenvDarwin; }; } diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 1ecb222af3ec..7063d7bfcb6a 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -175,6 +175,13 @@ rec { bootstrapTools = (import ./default.nix { inherit system bootstrapFiles; + + lib = assert false; null; + allPackages = assert false; null; + + platform = assert false; null; + crossSystem = assert false; null; + config = assert false; null; }).bootstrapTools; test = derivation { diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index a1f3a1c38c5c..31c51215676b 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -23,6 +23,10 @@ , # Allow a configuration attribute set to be passed in as an argument. config ? {} +, # 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 + , crossSystem ? null , platform ? assert false; null } @ args: @@ -72,7 +76,7 @@ in let inherit lib nixpkgsFun; } // newArgs); - stdenv = import ../stdenv { + stdenv = (args.stdenv or (import ../stdenv)) { inherit lib allPackages system platform crossSystem config; };