Skip to content
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

Feature request: builtins.fetchGitArchive #8134

Open
bergkvist opened this issue Mar 30, 2023 · 4 comments · May be fixed by #9031
Open

Feature request: builtins.fetchGitArchive #8134

bergkvist opened this issue Mar 30, 2023 · 4 comments · May be fixed by #9031
Labels
feature Feature request or proposal fetching Networking with the outside (non-Nix) world, input locking

Comments

@bergkvist
Copy link
Member

Is your feature request related to a problem? Please describe.

# Cloning a large repository is incredibly slow
builtins.fetchGit {
  url = "git@github.com:bergkvist/private-repo";
  ref = "refs/tags/v1.2.3";
}

When working with private git repos that need to be accessed over ssh, builtins.fetchGit is currently the most convenient alternative since it uses local git config - however it is incredibly slow. On a private repo I'm working with that is ~1GB in size, it takes more than an hour to run, and doesn't display any progress like git clone does. On the other hand, fetchTarball is significantly faster, but only works over http/doesn't work through ssh/git with local config/yubikey-setup.

Describe the solution you'd like

Git supports an archive command, which is ~100x faster than builtins.fetchGit in my case (20s vs 1h). A downside is that this doesn't work with submodules.

# Example usage
git archive --format=tar.gz --remote=git@github.com:bergkvist/private-repo v1.2.3 > private-repo-v1.2.3.tar.gz
builtins.fetchGitArchive {
  remote = "git@github.com:bergkvist/private-repo";
  format = "tar.gz";
  version = "v1.2.3";
  sha256 = "..."; # if not included, use the tarball-ttl
}
@bergkvist bergkvist added the feature Feature request or proposal label Mar 30, 2023
@thufschmitt
Copy link
Member

That looks pretty cool when supported!

Do you know which hosting providers do though? It looks like github doesn't at least

@bergkvist
Copy link
Member Author

Oh, I didn't realize github doesn't support this. gitlab (at least the self-hosted version) does though.

@SuperSandro2000
Copy link
Member

Why can't you use pkgs.fetchFromGitHub?

@roberth roberth added the fetching Networking with the outside (non-Nix) world, input locking label Apr 1, 2023
@bergkvist
Copy link
Member Author

bergkvist commented Apr 2, 2023

@SuperSandro2000 I'm using GitLab + private repos, and I want to fetch over ssh using my local ssh-config. (this allows for using a yubikey)

@zebreus zebreus linked a pull request Sep 24, 2023 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal fetching Networking with the outside (non-Nix) world, input locking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants