Skip to content

Fetching a github repo with submodules and checksum #229

Open
@markus1189

Description

Hi,

I have the following use case, but it seems like niv (currently) does not support it.

Here is the scenario:

  • I want to add https://github.com/darktable-org/darktable to niv
    • but only adding it as type=tarball does not allow me to fetch submodules, therefore the sha256 is incorrect (differs from the one with submodules)
    • using type=git and the unstable nix version as described in fetchGit and submodules #58 would work, but as I understand it, that means that niv update is a no-op on the json and everytime I import from sources.nix it will download the repo again (which takes a lot time)

What I want is a json entry that also has the sha256 set, such that the evaluation of sources.nix does not download the huge git repo everytime.

As far as I see, the problem is that the builtins.fetchgit does not support adding a sha256, so this would require fetchFromGitHub which is not builtin. I could change my sources.nix to add this, which is nice, but what I don't get is that niv update works and updates the package...

Can you confirm my observations? What would be a good way to add this behavior to the code? It seems like we could add a case on type in:

niv/src/Niv/Cli.hs

Lines 346 to 349 in f73bf8d

let cmd = case HMS.lookup "type" (unPackageSpec defaultSpec) of
Just "git" -> gitCmd
Just "local" -> localCmd
_ -> githubCmd

and for example use nix-prefetch-git for a github type?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions