You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an application that is setup as a cargo workspace. Some crates are plugins that should be compiled to WASM. How do I setup my flake to compile certain crates to wasm32-wasi target? The cross-compilation example only shows how to do it for a single root crate.
The text was updated successfully, but these errors were encountered:
Lean on lazy evaluation and on-demand building. Nix won't try to evaluate everything your expressions hypothetically define, only what you put in outputs. When you ask it to build an output, only the expressions that are actually evaluated can result in building.
Create a wasm32-wasi workspace and a native workspace. Pick only what you need when defining package outputs.
So basically your code will look the body of a cross example + the body of a host-host (native) example, and you will pick some outputs of those two things for your flake outputs. For defining a workspace shell, you can again do both by using devShells, but only one will be active at a time. Keep in mind, adding the two shells together at the same time is not fundamentally easy if there are collisions of variables and binaries that should be on PATH
You can even define the wasm32-wasi space first and use it as an input to the native workspace, pulling finished wasm32-wasi outputs into buildInputs
There is cleanup planned to make this workflow use more compact expressions. There's definitely a plan to add a wasm + Rust server + container example, which will motivate the development of more compact expressions using an override-like API
I have an application that is setup as a cargo workspace. Some crates are plugins that should be compiled to WASM. How do I setup my flake to compile certain crates to
wasm32-wasi
target? The cross-compilation example only shows how to do it for a single root crate.The text was updated successfully, but these errors were encountered: