summary refs log tree commit diff
path: root/pkgs/top-level/impure.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/impure.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/impure.nix')
-rw-r--r--pkgs/top-level/impure.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index 6999b7428ba..98094e93160 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -12,9 +12,11 @@ let
 
 in
 
-{ # Fallback: Assume we are building packages for the current (host, in GNU
-  # Autotools parlance) system.
-  system ? builtins.currentSystem
+{ # We combine legacy `system` and `platform` into `localSystem`, if
+  # `localSystem` was not passed. Strictly speaking, this is pure desugar, but
+  # it is most convient to do so before the impure `localSystem.system` default,
+  # so we do it now.
+  localSystem ? builtins.intersectAttrs { system = null; platform = null; } args
 
 , # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or
   # $HOME/.config/nixpkgs/config.nix.
@@ -49,4 +51,13 @@ in
 , ...
 } @ args:
 
-import ./. (args // { inherit system config overlays; })
+# If `localSystem` was explicitly passed, legacy `system` and `platform` should
+# not be passed.
+assert args ? localSystem -> !(args ? system || args ? platform);
+
+import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
+  inherit config overlays;
+  # Fallback: Assume we are building packages on the current (build, in GNU
+  # Autotools parlance) system.
+  localSystem = { system = builtins.currentSystem; } // localSystem;
+})