Skip to content

Commit

Permalink
mkDerivation: Fix cross compilation
Browse files Browse the repository at this point in the history
Derivations where drawing their `system` attribute from `hostPlatform`
instead of `buildPlatform`. Fix that, and add an explanatory commment.

Fixes #45993
  • Loading branch information
Ericson2314 committed Sep 4, 2018
1 parent 61deecd commit 06cd7c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 06cd7c1

Please sign in to comment.