summary refs log tree commit diff
path: root/pkgs/top-level/default.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-02-08 16:43:52 -0500
committerJohn Ericson <Ericson2314@Yahoo.com>2017-02-08 22:06:57 -0500
commit8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854 (patch)
tree3205517895f175c3e5578e7e7150a3de9ea16303 /pkgs/top-level/default.nix
parentcd10e3c4ffa3d6c729aab8778bf6027415025c44 (diff)
downloadnixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar.gz
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar.bz2
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar.lz
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar.xz
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.tar.zst
nixpkgs-8cd4c31d6b8c6432986edf0ec5d00d2fe1c12854.zip
top-level: Allow nixpkgs to take localSystem directly
This is instead of both system and platform, which is kind of ugly.
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r--pkgs/top-level/default.nix47
1 files changed, 17 insertions, 30 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index 3c67d316f7c..3e3ecdeea6c 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -17,8 +17,14 @@
    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
+{ # The system packages will be built on. See the manual for the
+  # subtle division of labor between these two `*System`s and the three
+  # `*Platform`s.
+  localSystem
+
+  # The system packages will ultimately be run on. Null if the two should be the
+  # same.
+, crossSystem ? null
 
 , # Allow a configuration attribute set to be passed in as an argument.
   config ? {}
@@ -27,12 +33,9 @@
   overlays ? []
 
 , # A function booting the final package set for a specific standard
-  # environment. See below for the arguments given to that function,
-  # the type of list it returns.
+  # environment. See below for the arguments given to that function, the type of
+  # list it returns.
   stdenvStages ? import ../stdenv
-
-, crossSystem ? null
-, platform ? assert false; null
 } @ args:
 
 let # Rename the function arguments
@@ -51,10 +54,10 @@ in let
 
   # Allow setting the platform in the config file. Otherwise, let's use a
   # reasonable default.
-  platform =
-    args.platform
-    or ( config.platform
-      or ((import ./platforms.nix).selectPlatformBySystem system) );
+  localSystem =
+    { platform = (import ./platforms.nix).selectPlatformBySystem args.localSystem.system; }
+    // builtins.intersectAttrs { platform = null; } config
+    // args.localSystem;
 
   # A few packages make a new package set to draw their dependencies from.
   # (Currently to get a cross tool chain, or forced-i686 package.) Rather than
@@ -71,7 +74,8 @@ in let
   # To put this in concrete terms, this function is basically just used today to
   # use package for a different platform for the current platform (namely cross
   # compiling toolchains and 32-bit packages on x86_64). In both those cases we
-  # want the provided non-native `system` argument to affect the stdenv chosen.
+  # want the provided non-native `localSystem` argument to affect the stdenv
+  # chosen.
   nixpkgsFun = newArgs: import ./. (args // newArgs);
 
   # Partially apply some arguments for building bootstraping stage pkgs
@@ -83,24 +87,7 @@ in let
   boot = import ../stdenv/booter.nix { inherit lib allPackages; };
 
   stages = stdenvStages {
-    # One would think that `localSystem` and `crossSystem` overlap horribly with
-    # the three `*Platforms` (`buildPlatform`, `hostPlatform,` and
-    # `targetPlatform`; see `stage.nix` or the manual). Actually, those
-    # identifiers I, @Ericson2314, purposefully not used here to draw a subtle
-    # but important distinction:
-    #
-    # While the granularity of having 3 platforms is necessary to properly
-    # *build* packages, it is overkill for specifying the user's *intent* when
-    # making a build plan or package set. A simple "build vs deploy" dichotomy
-    # is adequate: the "sliding window" principle described in the manual shows
-    # how to interpolate between the these two "end points" to get the 3
-    # platform triple for each bootstrapping stage.
-    #
-    # Also, less philosophically but quite practically, `crossSystem` should be
-    # null when one doesn't want to cross-compile, while the `*Platform`s are
-    # always non-null. `localSystem` is always non-null.
-    localSystem = { inherit system platform; };
-    inherit lib crossSystem config overlays;
+    inherit lib localSystem crossSystem config overlays;
   };
 
   pkgs = boot stages;