about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/systems/default.nix4
-rw-r--r--pkgs/top-level/default.nix4
-rw-r--r--pkgs/top-level/impure.nix5
3 files changed, 8 insertions, 5 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index ea18904cc635..8aa413f53817 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -14,7 +14,9 @@ rec {
   # `parsed` is inferred from args, both because there are two options with one
   # clearly prefered, and to prevent cycles. A simpler fixed point where the RHS
   # always just used `final.*` would fail on both counts.
-  elaborate = args: let
+  elaborate = args': let
+    args = if lib.isString args' then { system = args'; }
+           else args';
     final = {
       # Prefer to parse `config` as it is strictly more informative.
       parsed = parse.mkSystemFromString (if args ? config then args.config else args.system);
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index b6de076a570c..904ef8d39796 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -57,11 +57,11 @@ in let
 
   # 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 (
+  localSystem = lib.systems.elaborate (if builtins.isAttrs args.localSystem then (
     # Allow setting the platform in the config file. This take precedence over
     # the inferred platform, but not over an explicitly passed-in one.
     builtins.intersectAttrs { platform = null; } config1
-    // args.localSystem);
+    // args.localSystem) else args.localSystem);
 
   crossSystem = if crossSystem0 == null then localSystem
                 else lib.systems.elaborate crossSystem0;
diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix
index da288f15d2e2..3ba6c08a140b 100644
--- a/pkgs/top-level/impure.nix
+++ b/pkgs/top-level/impure.nix
@@ -85,6 +85,7 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
   inherit config overlays crossSystem crossOverlays;
   # Fallback: Assume we are building packages on the current (build, in GNU
   # Autotools parlance) system.
-  localSystem = (if args ? localSystem then {}
-                 else { system = builtins.currentSystem; }) // localSystem;
+  localSystem = if builtins.isString localSystem then localSystem
+                else (if args ? localSystem then {}
+                      else { system = builtins.currentSystem; }) // localSystem;
 })