about summary refs log tree commit diff
path: root/pkgs/top-level/default.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2016-11-27 12:35:58 -0800
committerJohn Ericson <jericson@galois.com>2016-11-30 19:10:59 -0500
commitd240a0da1ab03ef8838553229b72b9b37a0ef3e7 (patch)
treea1a6eeec3d31abe66228d2c14534d50dfc95e882 /pkgs/top-level/default.nix
parent07a2b17cbf541c485e04f1a8ec98ffe8c24ac713 (diff)
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
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r--pkgs/top-level/default.nix37
1 files changed, 28 insertions, 9 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index c5b8bbac31c03..d1e824a8070be 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -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