diff --git a/examples/cross-aarch64/shell.nix b/examples/cross-aarch64/shell.nix index b34fd8d9c9d..6fe9d43f2cb 100644 --- a/examples/cross-aarch64/shell.nix +++ b/examples/cross-aarch64/shell.nix @@ -1,18 +1,22 @@ -with import { +(import { crossSystem = "aarch64-linux"; overlays = [ (import ../..) ]; -}; +}).callPackage ( +{ mkShell, rust-bin, pkg-config, openssl, pkgsBuildBuild }: mkShell { nativeBuildInputs = [ # Manual `buildPackages` is required here. See: https://github.com/NixOS/nixpkgs/issues/49526 # build = host = x86_64, target = aarch64 - buildPackages.rust-bin.stable.latest.minimal - buildPackages.pkg-config - # build = host = target = x86_64, just to avoid re-build. + rust-bin.stable.latest.minimal + pkg-config + + # build = host = target = x86_64 + # qemu itself is multi-platform and `target` doesn't matter for it. + # Use build system's to avoid rebuild. pkgsBuildBuild.qemu ]; buildInputs = [ # build = x86_64, host = target = aarch64 openssl ]; -} +}) {} diff --git a/rust-overlay.nix b/rust-overlay.nix index 1e7d4e9d5a4..287f2821681 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -326,10 +326,9 @@ let # FIXME: If these propagated dependencies go components, darwin build will fail with "`-liconv` not found". - # use propagatedNativebuildinputs here because we want these dependencies to end up - # as buildPlatform dependencies on the derivation using the compiler even though - # they are targetPlatform dependencies from the compiler's perspective - propagatedNativeBuildInputs = [ self.stdenv.cc self.targetPackages.stdenv.cc ] ++ + # Ourselves have offset -1. In order to make these offset -1 dependencies of downstream derivation, + # they are offset 0 propagated. + propagatedBuildInputs = [ self.gcc self.buildPackages.gcc ] ++ self.lib.optional (self.stdenv.targetPlatform.isDarwin) self.targetPackages.libiconv; meta.platforms = self.lib.platforms.all;