nmattia / niv

Easy dependency management for Nix projects
https://github.com/nmattia/niv
MIT License
1.61k stars 79 forks source link

niv add git ... does not add checksum #214

Open tokudan opened 4 years ago

tokudan commented 4 years ago

niv does not add checksums for git repositories:

$ niv add git git@codeberg.org: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": "git@codeberg.org:tokudan/nur.git",
        "rev": "acb95091fa2430c48bd654ad1940ca1dd30fac48",
        "type": "git"
    }
}
nmattia commented 4 years ago

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?

tfc commented 4 years ago

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.

nmattia commented 4 years ago

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