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

Use `fetchFromGitHub` instead of `fetchgit` when the source is a GitHub clone URL #260

Open
taktoa opened this Issue Feb 7, 2017 · 9 comments

Comments

Projects
None yet
5 participants
@taktoa

taktoa commented Feb 7, 2017

Pretty self-explanatory. Should be very easy to implement, and will save some bandwidth for anyone who uses cabal2nix on GitHub repos (since, IIRC, it will only download the revision tarball, not the whole git repo).

It would also be nice if cabal2nix gave a warning when an SSH clone URL is given, since those are impure (they depend on the SSH keys in your home directory).

@taktoa

This comment has been minimized.

taktoa commented Feb 7, 2017

BTW, I might take a crack at this at some point, but I'm busy right now, so I figured I'd at least put up an issue.

@peti peti added the enhancement label Feb 8, 2017

@Fresheyeball

This comment has been minimized.

Fresheyeball commented Sep 11, 2017

What about those of us who are not using github? Can this be made compatible?

@taktoa

This comment has been minimized.

taktoa commented Sep 11, 2017

Then it should fall back to fetchgit? I didn't say "use fetchFromGitHub always"...

@domenkozar

This comment has been minimized.

Member

domenkozar commented Dec 9, 2017

@Fresheyeball it's possible to use shallow clone (--depth 1) on revision with some remotes if they have uploadpack.allowReachableSHA1InWant=true set (github does).

But the optimization should only be used for github.com urls.

@domenkozar

This comment has been minimized.

Member

domenkozar commented Dec 9, 2017

Depends on NixOS/nixpkgs#21732

@domenkozar

This comment has been minimized.

Member

domenkozar commented Dec 9, 2017

Besides bandwidth, time would be spent for any package set projects like stack2nix, hackage2nix, stackage2nix, etc.

@domenkozar

This comment has been minimized.

Member

domenkozar commented Dec 16, 2017

I've looked into how to implement this in cabal2nix.

fetchFromGitHub is really just a small wrapper around fetching a zip file.

Prefetching would be: nix-prefetch-url --unpack https://github.com/NixOS/nixpkgs/archive/f40f2f21c03bec1cabd2a59c1863659e8c4d60dc.zip. Generated Nix expression would use fetchFromGitHub { ... }.

cabal2nix currently just guesses what prefetcher to use, by trying all of them and using the first one to succeed.

I'd propose we add a flag like --fetcher and support github as one of the options, as I'm afraid any automatic guessing within cabal2nix is going to be hard to get right.

Thoughts? /cc @peti

@peti

This comment has been minimized.

Member

peti commented Dec 18, 2017

Personally, I am rather unhappy about the current "guessing code" and would love to replace it with a more deterministic solution that chooses the appropriate src value based on the command-line configuration.

@Infinisil Infinisil referenced this issue Jul 22, 2018

Merged

futhark: init at 0.6.2 #43865

4 of 6 tasks complete
@nh2

This comment has been minimized.

Contributor

nh2 commented Sep 14, 2018

See input-output-hk/stack2nix#130 for more problems relating to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment