top-level: Remove cycles: stdenv calls in top-level but not vice versa

This commit changes the dependencies of stdenv, and clean-up the stdenv
story by removing the `defaultStdenv` attribute as well as the `bootStdenv`
parameter.

Before, the final bootstrapping stage's stdenv was provided by
all-packages, which was iterating multiple times over the
top-level/default.nix expression, and non-final bootstrapping stages'
stdenvs were explicitly specified with the `bootStdenv` parameter.

Now, all stages' stdenvs are specified with the `stdenv` parameter.
For non-final bootstrapping stages, this is a small change---basically just
rename the parameter.
For the final stage, top-level/default.nix takes the chosen stdenv and
makes the final stage with it.

`allPackages` is used to make all bootstrapping stages, final and
non-final alike. It's basically the expression of `stage.nix` (along with a
few partially-applied default arguments)

Note, the make-bootstrap-tools scripts are temporarily broken
This commit is contained in:
John Ericson
2016-11-30 19:10:59 -05:00
committed by John Ericson
parent 07a2b17cbf
commit d240a0da1a
10 changed files with 55 additions and 44 deletions
+28 -9
View File
@@ -1,8 +1,21 @@
/* 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. */
/* This function composes the Nix Packages collection. It:
1. Applies the final stage to the given `config` if it is a function
2. Infers an appropriate `platform` based on the `system` if none is
provided
3. Defaults to no non-standard config and no cross-compilation target
4. Uses the above to infer the default standard environment (stdenv) if
none is provided
5. Builds the final stage --- a fully booted package set with the chosen
stdenv
Use `impure.nix` to also infer the `system` based on the one on which
evaluation is taking place, and the configuration from environment variables
or dot-files. */
{ # The system (e.g., `i686-linux') for which to build the packages.
system
@@ -12,7 +25,6 @@
, crossSystem ? null
, platform ? null
, ...
} @ args:
let # Rename the function arguments
@@ -57,8 +69,15 @@ in let
# deterministically inferred the same way.
nixpkgsFun = newArgs: import ./. (args // newArgs);
pkgs = import ./stage.nix ({
inherit lib nixpkgsFun config platform;
} // args);
# Partially apply some args for building bootstraping stage pkgs sets
allPackages = newArgs: import ./stage.nix ({
inherit lib nixpkgsFun config;
} // newArgs);
stdenv = import ../stdenv {
inherit lib allPackages system platform crossSystem config;
};
pkgs = allPackages { inherit system stdenv config crossSystem platform; };
in pkgs