Commit c9b74e49 authored by Alyssa Ross's avatar Alyssa Ross
Browse files

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: e3e57b8f ("lib.systems: elaborate Rust metadata")
parent 62f7a6dc
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -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: {