Open YPares opened 3 weeks ago
You are bumping into this issue because, most likely, you have git dependency in Cargo.toml
. crate2nix will try to determine the crate's hash by downloading the crate using nix-prefetch-git
. However, nix-prefetch-git
is not added as a dependency to the generatedCargoNix
derivation. However, adding it is not going to help you much, since crate2nix
runs in a sandbox, so it cannot fetch the crate over the network anyway.
The solution is to run crate2nix
in your Rust source folder once. This will create a crate-hashes.json
file that contains the fixed-output derivation hashes for the Rust crates that are fetched using git. Add this file to your Nix repo/flake and crate2nix will use it (and not attempt to call nix-prefetch-git
).
@danieldk Thanks! I'll try that. I suppose then that I should re-run crate2nix
manually everytime a git-provided crate has to change?
I'm not sure it's part of crate2nix documentation, could it be added? I think notable here: https://nix-community.github.io/crate2nix/00_guides/31_auto_generating/
I'm running into this:
It's difficult to make a minimal reproduction but just in case is it a known error? I tried running
cargo update
but that doesn't change anything.