3
0
Fork 0
forked from mirrors/nixpkgs

mkDerivation: Fix cross compilation

Derivations where drawing their `system` attribute from `hostPlatform`
instead of `buildPlatform`. Fix that, and add an explanatory commment.

Fixes #45993
This commit is contained in:
John Ericson 2018-09-03 23:03:38 -04:00
parent 61deecdc34
commit 06cd7c15a3

View file

@ -187,7 +187,15 @@ rec {
builder = attrs.realBuilder or stdenv.shell;
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
inherit stdenv;
inherit (stdenv.hostPlatform) system;
# The `system` attribute of a derivation has special meaning to Nix.
# Derivations set it to choose what sort of machine could be used to
# execute the build, The build platform entirely determines this,
# indeed more finely than Nix knows or cares about. The `system`
# attribute of `buildPlatfom` matches Nix's degree of specificity.
# exactly.
inherit (stdenv.buildPlatform) system;
userHook = config.stdenv.userHook or null;
__ignoreNulls = true;