From a578479a42a5d2033cc9fa77f236545f9bec5873 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 17 Nov 2023 20:21:33 +0100 Subject: [PATCH] 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: e3e57b8f1885 ("lib.systems: elaborate Rust metadata") --- pkgs/top-level/all-packages.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7fb9cdafdd724..569df5ad80909 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16938,13 +16938,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: {