crate2nix
crate2nix copied to clipboard
Supporting wasm-pack
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.
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!
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.