summary refs log tree commit diff
path: root/pkgs/top-level/default.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-03-23 20:49:28 -0400
committerJohn Ericson <Ericson2314@Yahoo.com>2017-04-17 17:13:01 -0400
commit3efc661a1de6a2ce9b98aa39283e68914297b8d7 (patch)
treecc7467715da0a521a692c13b825cf8cc67fa2d98 /pkgs/top-level/default.nix
parentd86caa3216dce17f54c1505a751cf5b403fd8bcf (diff)
downloadnixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar.gz
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar.bz2
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar.lz
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar.xz
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.tar.zst
nixpkgs-3efc661a1de6a2ce9b98aa39283e68914297b8d7.zip
Elaborate `localSystem` and `crossSystem` in a consistent manner
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r--pkgs/top-level/default.nix16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index 48dbe7118bc..5d3da35c54f 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -40,6 +40,7 @@
 
 let # Rename the function arguments
   configExpr = config;
+  crossSystem0 = crossSystem;
 
 in let
   lib = import ../../lib;
@@ -52,12 +53,15 @@ in let
     then configExpr { inherit pkgs; }
     else configExpr;
 
-  # Allow setting the platform in the config file. Otherwise, let's use a
-  # reasonable default.
-  localSystem =
-    { platform = lib.systems.platforms.selectPlatformBySystem args.localSystem.system; }
-    // builtins.intersectAttrs { platform = null; } config
-    // args.localSystem;
+  # From a minimum of `system` or `config` (actually a target triple, *not*
+  # nixpkgs configuration), infer the other one and platform as needed.
+  localSystem = lib.systems.elaborate (
+    # Allow setting the platform in the config file. This take precedence over
+    # the inferred platform, but not over an explicitly passed-in onw.
+    builtins.intersectAttrs { platform = null; } config
+    // args.localSystem);
+
+  crossSystem = lib.mapNullable lib.systems.elaborate crossSystem0;
 
   # 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