Fix native compilation on aarch64

Turns out fenix.packages.aarch64-linux.targets.x86_64-*.minimal.rustc
is an x86_64 compiler. The only component that you actually need to pull
from 'targets' for cross compilation is rust-std.

Because x86_64-unknown-linux-gnu is first in the target list, we were
getting x86 rustc and cargo binaries, making it impossible to compile
grapevine on an aarch64 host.

We were also missing aarch64-unknown-linux-gnu in the targets list,
which is used by the default package on a aarch64 host.
This commit is contained in:
Olivia Lee 2025-03-02 01:08:31 -08:00
parent 65ec500d75
commit 57c79b1999
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9
2 changed files with 9 additions and 4 deletions

View file

@ -59,12 +59,16 @@
toolchainFile.toolchain.components;
targets = toolchainFile.toolchain.targets;
fenix = inputs.fenix.packages.${pkgs.stdenv.buildPlatform.system};
in
fenix.combine (builtins.map
nativeToolchain = (fenix.fromManifestFile inputs.rust-manifest)
.withComponents components;
crossComponents = builtins.map
(target:
(fenix.targets.${target}.fromManifestFile inputs.rust-manifest)
.withComponents components)
targets);
.rust-std)
targets;
in
fenix.combine ([nativeToolchain] ++ crossComponents);
website-root = self.callPackage ./nix/pkgs/website-root {};
});

View file

@ -17,5 +17,6 @@ components = [
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
]