impure.nix: fix handling of localSystem
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
commit31eac6fd0088710c193efebb632f1c97ef3045a6
authorMatthew Bauer <mjbauer95@gmail.com>
dateSun 24 Jun 2018, 23:15 (8 years ago)
parent5000cc5
pkgs/top-level/impure.nix+2−1
@@ -83,5 +83,6 @@ import ./. (builtins.removeAttrs args [ "system" "platform" ] // {
8383 inherit config overlays crossSystem;
8484 # Fallback: Assume we are building packages on the current (build, in GNU
8585 # Autotools parlance) system.
86− localSystem = { system = builtins.currentSystem; } // localSystem;
86+ localSystem = (if args ? localSystem then {}
87+ else { system = builtins.currentSystem; }) // localSystem;
8788})