Rust with git deps: symbolic link error to cargo vendor dep

Struggling to build a rust package that has git dependencies in the Cargo.lock file.

Using:

cargoLock = {
    lockFile = "${src}/Cargo.lock";
    outputHashes = {
         "anyhow-1.0.28" = "sha256-Orcx09G6uAEHrKoAFYLDLp9B4o0T+OZ3JrHhWLBs/IU=";
         "base64-0.13.0" = "sha256-L/R6EVnWYT5sgfBFs9irtvsUlS0Miij22lb7GwZlX3g=";
    };
};

to specify the dependencies but running into a symbolic link error, due to a permission denied error.

> ln: failed to create symbolic link '/nix/store/qihn53dpwvbvzyasvc19c7hb10hsj9j8-cargo-vendor-dir/base64-0.13.0/9pmzirdvm6ldai07lcdiqzsllfzsdxx6-base64-0.13.0': Permission denied

Cannot find much information online except for this issue which mentions the same error [replace] doesn't replace in rustBuildPackage · Issue #22177 · NixOS/nixpkgs · GitHub

Are there multiple anyhow 1.0.28 entries in Cargo.lock?

Good question! Yes there are.

this is not supported by buildRustPackage, you might want to patch it

Ah ok, thanks … by patching it you mean removing duplicate entries in the Cargo.lock file?

yep (character limit)

1 Like