Fetching/building cargo deps/artifacts fails when using git dependencies that (seem to) use git-lfs
Describe the bug
When using a git dependency that seems to use git-lfs, buildDepsOnly fails with the error
fetching git input 'git+file:///home/fea/dev/rust/crane-bug-lfs'
fetching git input 'git+https://github.com/Leafwing-Studios/leafwing-input-manager'
Downloading assets/Montserrat/Montserrat-Italic-VariableFont_wght.ttf (404 KB)
Error downloading object: assets/Montserrat/Montserrat-Italic-VariableFont_wght.ttf (0a85590): Smudge error: Error downloading assets/Montserrat/Montserrat-Italic-VariableFont_wght.ttf (0a855909413334f09fbec411b4b6cf0b3e3a552341492658f43a59294479a362): error initializing custom adapter "lfs-standalone-file" worker 0: [0] error creating handler: no valid file:// URLs found
Errors logged to '/tmp/nix-163009-1/lfs/logs/20240828T124325.77098434.log'.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: assets/Montserrat/Montserrat-Italic-VariableFont_wght.ttf: smudge filter lfs failed
error:
… while evaluating 'strict' to select 'drvPath' on it
at /builtin/derivation.nix:1:552:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:1:208:
(stack trace truncated; use '--show-trace' to show the full trace)
error: program 'git' failed with exit code 128
In my case, the problematic git dependency is https://github.com/Leafwing-Studios/leafwing-input-manager/ (and appearently specifically the assets subdirectory of it).
Reproduction
This is a minimal reproduction that simply tries to buildDepsOnly with leafwing-input-manager as a git dependency: https://github.com/feathecutie/crane-bug-lfs
Simply build the default package to reproduce:
nix build github:feathecutie/crane-bug-lfs
Hi @feathecutie thanks for the report!
It's worth noting that our vendor logic uses one of two different fetchers:
- if output hashes for git deps are defined, then we will use
pkgs.fetchgit. Looking at the upstream source I can see it takes afetchLfsparameter which we can hard-code totruegoing forward - if output hashes are not set (the default behavior), then we will use
builtins.fetchGitwhich as far as I can tell doesn't accept any additional parameters. In other words, whether or not LFS is fetched depends on your Nix implementation...
Which version of Nix are you using?
My output of nix --version shows nix (Lix, like Nix) 2.90.0 and it's worth noting that your reproduction flake seemed to build fine for me. I'd recommend upgrading to a newer Nix if you can and see if that solves the problem