-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetching a github repo with submodules and checksum #229
Comments
i just commented on a similar matter here: #214 The whole thing with submodules support would also be very interesting for me. |
(Sorry for the late reply, I was out and still catching up on notifications)
No, it should still update the
What exactly downloads the repo?
|
hey @nmattia, i wrote my comments a bit with a hot needle. it somehow seems that |
No worries!
Using the
I think I didn't put that in the right words :) Using |
Hey guys, quick update. I didn't drop the ball, but I opened a pretty big can of worm when I started working on #111 (implementation here: #258). NOTE: ok this is longer than I thought but writing this down made it a bit clearer in my head. Feedback very much welcome. I'll start with a quick recap of how niv works and what it does; then I'll give a quick overview of potential solutions. There are two sides of niv: one is the "Nix evaluation" that's provided with Now, let's focus on git repositories (including GitHub projects). What's the best fetcher? Well, that depends on three factors: Is the repository public on GitHub? Does the repository require (SSH-)authentication for a note: I'll talk about
So basically, if your repo is public and on GitHub, Ok, now let's figure out how the update part of niv can figure out the latest rev and default branch. There's basically three ways: for one, you can query the GitHub API. Alternatively, you can use
In some cases where you need to clone the repo anyway (see below) then you might as well use Finally, in the "fetcher" section above I said that
Basically: use the GitHub API as much as possible, but fall back to git clone when you can't. When the clone is taking too long, tell the user they could use GitHub instead (or, if only the date is needed, then do something like There's a few other details (how does niv figure out if a repo is on GitHub, private, has submodules?) but that's more of a |
@nmattia Thanks a lot for this write-up, it really helped me understand the problem better. I'm in the situation that I need to get the If you see this as sensible I could implement a new type (maybe |
@flandweber I'm not sure if I remember everything correctly, but:
I think that's fine, though it could also be an attribute on the existing |
You're right, I'll see to implement it as an additional attribute! |
Hi,
I have the following use case, but it seems like
niv
(currently) does not support it.Here is the scenario:
type=tarball
does not allow me to fetch submodules, therefore thesha256
is incorrect (differs from the one with submodules)type=git
and the unstable nix version as described in fetchGit and submodules #58 would work, but as I understand it, that means thatniv update
is a no-op on thejson
and everytime I import fromsources.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 ofsources.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 asha256
, so this would requirefetchFromGitHub
which is not builtin. I could change my sources.nix to add this, which is nice, but what I don't get is thatniv 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
and for example use
nix-prefetch-git
for agithub
type?The text was updated successfully, but these errors were encountered: