A new, faster evaluation-time Git fetcher

Hey y’all,

Over the past few weeks I’ve been working with @shlevy at Target to make an evaluation-time Nix fetcher for Git repositories. It has a few improvements documented in the readme, but briefly:

✓ way faster clones!
✓ shallow clones, sometimes!
✓ annotated tags!
✓ works with builtins.filterSource!
✓ morally pure if you follow good tagging etiquette!

Ideally we’ll be able to get the improvements upstream. We’ve gone this route to make it easier to prototype and prove out the changes.

Check it out, and let me know what you think =)


Sweet! Does it support submodules? builtins.fetchGit currently does not :frowning:

I suppose this depends if shallow clones support git submodules. Theoretically it should be possible.

“morally pure” got me :slight_smile:

1 Like

You mean git clone --shallow-submodules?

Does it support private repos like builtins.fetchGit?

sounds exciting. Maybe add a comment on how to install for those who never installed any nix plugin

1 Like

Just wanted to note, you can add nix-plugins like this (excerpt from configuration.nix):

    nixpkgs-unstable = (import (fetchGit {
      url = https://github.com/NixOS/nixpkgs-channels;
      ref = "nixos-unstable";
    }) { config = { allowUnfree = true; }; });
  in {
      nix.extraOptions = ''
        plugin-files = ${nixpkgs-unstable.nix-plugins}/lib/nix/plugins/libnix-extra-builtins.so

After this setup, you can then try and run the test in the nix-fetchers repo with ./test/run.

Edit: I found that out through Introduction - couldn’t for the life of me find it in the nix-plugins repo.

1 Like

@manveru Hm, adding plugin-files to my nix.conf just gives me illegal configuration line 'plugin-files ...' no matter what version of nix I use.

Copying the line from nix.conf and using it as a command line option instead with --plugin-files seems to work though?

Derp, I forgot the equals sign :stuck_out_tongue:

1 Like