From 31eac6fd0088710c193efebb632f1c97ef3045a6 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 24 Jun 2018 23:15:09 -0400 Subject: [PATCH] impure.nix: fix handling of localSystem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we passed a localSystem in, we don’t want the current system to override it. Now we check for localSystem first to avoid getting "mixed" localSystem values from commands like this: nix-build --arg localSystem '{config="x86_64-unknown-linux-musl";}' -A hello Which would eventually evaluate localSystem to this: { config = "x86_64-unknown-linux-musl"; system = "x86_64-darwin"; } & Nix would not be able to run it correctly. Fixes #41599 /cc @Ericson2314 --- pkgs/top-level/impure.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/impure.nix b/pkgs/top-level/impure.nix index df462665dd1..dafa351c4e4 100644 --- a/pkgs/top-level/impure.nix +++ b/pkgs/top-level/impure.nix @@ -83,5 +83,6 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // { inherit config overlays crossSystem; # Fallback: Assume we are building packages on the current (build, in GNU # Autotools parlance) system. - localSystem = { system = builtins.currentSystem; } // localSystem; + localSystem = (if args ? localSystem then {} + else { system = builtins.currentSystem; }) // localSystem; })