about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-09-03 23:03:38 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-09-03 23:18:24 -0400
commit06cd7c15a3f2d990316b8c685226d8155f0304cf (patch)
tree64f6632034984f2d2722daf259c4f7e2c7bd2835 /pkgs/stdenv
parent61deecdc34fc609d0f805b434101f3c8ae3b807a (diff)
downloadnixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar.gz
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar.bz2
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar.lz
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar.xz
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.tar.zst
nixlib-06cd7c15a3f2d990316b8c685226d8155f0304cf.zip
mkDerivation: Fix cross compilation
Derivations where drawing their `system` attribute from `hostPlatform`
instead of `buildPlatform`. Fix that, and add an explanatory commment.

Fixes #45993
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 8af6d0e04008..e1ce3200e8c9 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -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;