nvfetcher icon indicating copy to clipboard operation
nvfetcher copied to clipboard

Git prefetcher producing the wrong hashes for repos with submodules

Open moni-dz opened this issue 1 year ago • 0 comments

nix-prefetch producing differing hashes than nix-prefetch-git causes my CI to fail

Manually running nix-prefetch and nix-prefetch-git as a comparison

~ ❯ nix run nixpkgs#nix-prefetch -- fetchgit --url https://github.com/riverwm/river --fetchSubmodules
The fetcher will be called as follows:
> fetchgit {
>   fetchSubmodules = true;
>   sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
>   url = "https://github.com/riverwm/river";
> }

sha256-x2Dlvfq4fwg8UzJID1xGYAXX8EOGfpZHwefCwiwjPC0=
~ ❯ nix-prefetch-git --url https://github.com/riverwm/river --fetch-submodules --quiet
{
  "url": "https://github.com/riverwm/river",
  "rev": "b58bd829c28435799e2c080acf75f245b51e246b",
  "date": "2022-07-02T21:46:12+02:00",
  "path": "/nix/store/0blaziwlmlyplyp3y8s8pg1lsrshcvm4-river",
  "sha256": "1r76gmqfn05sgqphsw33w79k2470r4hxfmdify011g0dhf93k5pz",
  "fetchLFS": false,
  "fetchSubmodules": true,
  "deepClone": false,
  "leaveDotGit": false
}

~ took 39s ❯ nix hash to-sri sha256:1r76gmqfn05sgqphsw33w79k2470r4hxfmdify011g0dhf93k5pz
sha256-/5Y5koMNvBCAd7FV1yHJ4BAx0+FjcA0vfroA63B95uQ=

Relevant lines in nvfetcher.toml:

[river]
src.git = "https://github.com/riverwm/river"
fetch.git = "https://github.com/riverwm/river"
git.fetchSubmodules = true

I would file an issue on nix-prefetch but it seems as that repository hasn't had any activity for a while now, and the move from nix-prefetch-git to nix-prefetch in 6ce85d33bbbc6345a2952fcc01a1de964b668834 is apparently causing issues.

moni-dz avatar Jul 07 '22 10:07 moni-dz