git.iko.soy/typeable/nixpkgs
on master help sign in
mkDerivation: Fix cross compilation

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

commit06cd7c15a3f2d990316b8c685226d8155f0304cf authorJohn Ericson <John.Ericson@Obsidian.Systems> dateMon 3 Sep 2018, 23:03 (8 years ago) parent61deecd
1 file changed+9−1
pkgs/stdenv/generic/make-derivation.nix+9−1
pkgs/stdenv/generic/make-derivation.nix+9−1
@@ -187,7 +187,15 @@ rec {
187187 builder = attrs.realBuilder or stdenv.shell;
188188 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
189189 inherit stdenv;
190− inherit (stdenv.hostPlatform) system;
190+
191+ # The `system` attribute of a derivation has special meaning to Nix.
192+ # Derivations set it to choose what sort of machine could be used to
193+ # execute the build, The build platform entirely determines this,
194+ # indeed more finely than Nix knows or cares about. The `system`
195+ # attribute of `buildPlatfom` matches Nix's degree of specificity.
196+ # exactly.
197+ inherit (stdenv.buildPlatform) system;
198+
191199 userHook = config.stdenv.userHook or null;
192200 __ignoreNulls = true;
193201