Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable wasm target in Rust toolchain in Nix Flake #927

Closed
wants to merge 2 commits into from

Conversation

mpontus
Copy link

@mpontus mpontus commented Aug 25, 2022

This is an attempt at enabling wasm build when building with nix build.

It enables wasm target in Rust toolchain using fenix.fromTemplateFile to create the toolchain from rust-toolchain.toml and add supported targets.

This fixes wasm32-unknown-unknown target error when building without SKIP_WASM_BUILD, but the build fails: with a different error: https://github.com/mpontus/centrifuge-chain/runs/8018805277?check_suite_focus=true

It fails because cargo can't vendor crates from a git source if they reference creates from a parent directory, such
cargo can't vendor crates from a git source if they reference crates from a parent directory, which appears to be the intended behavior: rust-lang/cargo#8885 (comment)

This enables wasm target in Rust toolchain used to build the package.
@mpontus

This comment was marked as outdated.

@mpontus
Copy link
Author

mpontus commented Sep 19, 2022

cargo vendor is used by buildRustPackage to vendor crates for offline access during thebuild step: https://github.com/NixOS/nixpkgs/blob/1066f0ef92a2f869709eb0515694a1139f23065c/pkgs/build-support/rust/fetch-cargo-tarball/default.nix#L72

Alternative rust buildsers: crane and naersk also use it to vendor dependencies and consider it to be an upstream (cargo) issue:

And the current consensus is calling it the indented behavior: With the current consus calling this the intended behavior: rust-lang/cargo#8885 (comment)

@mikiquantum mikiquantum changed the base branch from parachain to main September 23, 2022 23:00
@mustermeiszer
Copy link
Collaborator

I close this for now. Am cleaning up a bit. Feel free to re-open if still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants