rustc-wasm32: fix targetPlatform

The previous version stopped working when we started elaborating Rust
metadata.  Here, I've made it a bit nicer by actually setting
targetPlatform to an elaborated system.  Setting the config to wasi to
get elaborate to understand it is a bit of a hack, but I think it's
less of a hack than what we had before.

The only actual difference this makes to the rustc-wasm32 derivation
compared to the previous working version, is that now crt-static is
set.  This is probably the right thing anyway.

Fixes: e3e57b8f18 ("lib.systems: elaborate Rust metadata")
This commit is contained in:
Alyssa Ross 2023-11-17 20:21:33 +01:00
parent 62f7a6dcc1
commit c9b74e4908

View File

@ -16933,13 +16933,10 @@ with pkgs;
# https://github.com/NixOS/nixpkgs/issues/89426
rustc-wasm32 = (rustc.override {
stdenv = stdenv.override {
targetPlatform = stdenv.targetPlatform // {
parsed = {
cpu.name = "wasm32";
vendor.name = "unknown";
kernel.name = "unknown";
abi.name = "unknown";
};
targetPlatform = lib.systems.elaborate {
# lib.systems.elaborate won't recognize "unknown" as the last component.
config = "wasm32-unknown-wasi";
rust.config = "wasm32-unknown-unknown";
};
};
}).overrideAttrs (old: {