@@ -17,8 +17,14 @@
1717 evaluation is taking place, and the configuration from environment variables
1818 or dot-files. */
1919
20−{ # The system (e.g., `i686-linux') for which to build the packages.
21− system
20+{ # The system packages will be built on. See the manual for the
21+ # subtle division of labor between these two `*System`s and the three
22+ # `*Platform`s.
23+ localSystem
24+
25+ # The system packages will ultimately be run on. Null if the two should be the
26+ # same.
27+, crossSystem ? null
2228
2329, # Allow a configuration attribute set to be passed in as an argument.
2430 config ? {}
@@ -27,12 +33,9 @@
2733 overlays ? []
2834
2935, # A function booting the final package set for a specific standard
30− # environment. See below for the arguments given to that function,
31− # the type of list it returns.
36+ # environment. See below for the arguments given to that function, the type of
37+ # list it returns.
3238 stdenvStages ? import ../stdenv
33−
34−, crossSystem ? null
35−, platform ? assert false; null
3639} @ args:
3740
3841let # Rename the function arguments
@@ -51,10 +54,10 @@ in let
5154
5255 # Allow setting the platform in the config file. Otherwise, let's use a
5356 # reasonable default.
54− platform =
55− args.platform
56− or ( config.platform
57− or ((import ./platforms.nix).selectPlatformBySystem system) );
57+ localSystem =
58+ { platform = (import ./platforms.nix).selectPlatformBySystem args.localSystem.system; }
59+ // builtins.intersectAttrs { platform = null; } config
60+ // args.localSystem;
5861
5962 # A few packages make a new package set to draw their dependencies from.
6063 # (Currently to get a cross tool chain, or forced-i686 package.) Rather than
@@ -71,7 +74,8 @@ in let
7174 # To put this in concrete terms, this function is basically just used today to
7275 # use package for a different platform for the current platform (namely cross
7376 # compiling toolchains and 32-bit packages on x86_64). In both those cases we
74− # want the provided non-native `system` argument to affect the stdenv chosen.
77+ # want the provided non-native `localSystem` argument to affect the stdenv
78+ # chosen.
7579 nixpkgsFun = newArgs: import ./. (args // newArgs);
7680
7781 # Partially apply some arguments for building bootstraping stage pkgs
@@ -83,24 +87,7 @@ in let
8387 boot = import ../stdenv/booter.nix { inherit lib allPackages; };
8488
8589 stages = stdenvStages {
86− # One would think that `localSystem` and `crossSystem` overlap horribly with
87− # the three `*Platforms` (`buildPlatform`, `hostPlatform,` and
88− # `targetPlatform`; see `stage.nix` or the manual). Actually, those
89− # identifiers I, @Ericson2314, purposefully not used here to draw a subtle
90− # but important distinction:
91− #
92− # While the granularity of having 3 platforms is necessary to properly
93− # *build* packages, it is overkill for specifying the user's *intent* when
94− # making a build plan or package set. A simple "build vs deploy" dichotomy
95− # is adequate: the "sliding window" principle described in the manual shows
96− # how to interpolate between the these two "end points" to get the 3
97− # platform triple for each bootstrapping stage.
98− #
99− # Also, less philosophically but quite practically, `crossSystem` should be
100− # null when one doesn't want to cross-compile, while the `*Platform`s are
101− # always non-null. `localSystem` is always non-null.
102− localSystem = { inherit system platform; };
103− inherit lib crossSystem config overlays;
90+ inherit lib localSystem crossSystem config overlays;
10491 };
10592
10693 pkgs = boot stages;