mirror of
https://github.com/oxalica/rust-overlay.git
synced 2025-10-06 00:02:40 +02:00
The un-versioned `wasm32-wasi` target is removed in favor of `wasm32-wasip?` since Rust 1.84. Examples are updated. The nixpkgs patch for WASI target name remapping is merged in 24.11. We can also safely remove the workaround.
33 lines
1.1 KiB
Nix
33 lines
1.1 KiB
Nix
# See docs/cross_compilation.md for details.
|
|
(import <nixpkgs> {
|
|
crossSystem = {
|
|
config = "wasm32-wasi";
|
|
|
|
# NB. Rust use a different naming convention for target platforms and
|
|
# differentiates multiple version of WASI specification by using "wasip?".
|
|
# If this line is omitted, `wasm32-wasip1` (WASI 0.1) is assumed.
|
|
# See: <https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html>
|
|
#
|
|
# If you changed this, also update `CARGO_TARGET_*_RUNNER` below.
|
|
rust.rustcTarget = "wasm32-wasip1";
|
|
|
|
# Nixpkgs currently only supports LLVM lld linker for wasm32-wasi.
|
|
useLLVM = true;
|
|
};
|
|
overlays = [ (import ../..) ];
|
|
}).callPackage (
|
|
# We don't need WASI C compiler from nixpkgs, so use `mkShellNoCC`.
|
|
{ mkShellNoCC, stdenv, rust-bin, wasmtime }:
|
|
mkShellNoCC {
|
|
nativeBuildInputs = [ rust-bin.stable.latest.minimal ];
|
|
|
|
depsBuildBuild = [ wasmtime ];
|
|
|
|
# This is optional for wasm32-like targets, since rustc will automatically use
|
|
# the bundled `lld` for linking.
|
|
# CARGO_TARGET_WASM32_WASIP1_LINKER =
|
|
|
|
CARGO_TARGET_WASM32_WASIP1_RUNNER = "wasmtime run";
|
|
}) {}
|
|
|