niv icon indicating copy to clipboard operation
niv copied to clipboard

niv add git ... does not add checksum

Open tokudan opened this issue 4 years ago • 3 comments

niv does not add checksums for git repositories:

$ niv add git [email protected]:tokudan/nur.git
Adding package nur
  Writing new sources file
Done: Adding package nur

$ niv update
Updating all packages
  Package: nur
Done: Updating all packages

$ cat nix/sources.json
{
    "nur": {
        "ref": "master",
        "repo": "[email protected]:tokudan/nur.git",
        "rev": "acb95091fa2430c48bd654ad1940ca1dd30fac48",
        "type": "git"
    }
}

tokudan avatar Mar 14 '20 12:03 tokudan

That is correct. Those could be added, we need to figure out we we want to re implement the hashing or use nix-prefetch-git. Right now only builtins.fetchgit is supported which doesn't need checksums. Do you need checksums for e.g. pkgs.fetchGit?

nmattia avatar Mar 23 '20 10:03 nmattia

Hi,

i just ran across the same thing. I would like to export the niv attrset to a json file like {"a": "/nix/store/a...", "b": "/nix/store/b...", ...} and calculate and store its closure in some offline-nixstore, so that machines that re-evaluate the expressions don't need to re-download.

This does generally work after mapping all those store paths through builtins.storePath, but it does not work for git packages in niv due to the missing sha hash (so there is no upfront-storepath calculation and it tries to download).

Speaking for myself, i would need some method to describe the hash in niv (so that niv update does something) and then get the stuff checked out from repos where i can only authenticate via git/ssh.

tfc avatar Jul 01 '20 13:07 tfc

@tfc so do you just need a sha256 field? that's definitely doable

nmattia avatar Jul 27 '20 09:07 nmattia