crate2nix icon indicating copy to clipboard operation
crate2nix copied to clipboard

Supporting wasm-pack

Open manveru opened this issue 4 years ago • 2 comments

I'm trying to package https://github.com/input-output-hk/js-chain-libs which requires that I run wasm-pack build and wasm-pack pack inside the derivation.

It seems like wasm-pack invokes cargo build --lib --release --target wasm32-unknown-unknown, which then tries to fetch dependencies from crates.io.

You can find my code at: https://gist.github.com/manveru/6358ae1d4c00bbf0dd0d94a88bd098a2 I'd really appreciate any hints of how to make cargo find the dependencies in the derivation, given that I can't invoke cargo build or rustc directly.

manveru avatar Sep 10 '19 10:09 manveru

Puuuh. That sounds like it might need some proper thinking and tinkering.

If you can suggest some "simple" differences in the generated nix build files or some enhancements to buildRustCrate that would make this work, there is a chance that we can support that. I probably will not dive into this on my own soon. Sorry!

kolloch avatar Sep 14 '19 12:09 kolloch

Would there be any way to wrap the rustc inside the derivation to append the needed flags to find the dependencies? I could make the wapper myself, but i'm not sure how to get the list of all dependencies needed...

I don't know if that would make cargo stop looking for it though, it might still want to have a crates.io index.

manveru avatar Sep 14 '19 12:09 manveru