Today I tried to use the git+https:// scheme for a flake input, like git+https://github.com/nixos/nixpkgs?ref=nixos-22.05-small, it was very long to download so I assume it downloaded the entire git repository But I can’t figure where it’s stored, it should be big enough to spot it with ncdu but I can’t…
Is nix keeping the repo somewhere and keeping it up to date when using nix flake update? I’m tired of having to download 30 MB tarballs for 3 versions of nixpkgs (release, release-small and unstable), if this is working like I think it is, that’s pretty cool to be able to download incremental changes and having it integrated into flakes
I agree that it worth investigating whether switching all github: references to git+https: would save some time, especially if you already have a clone of the repo that you’re working on (you could use some git trickery to use it as a cache for objects).
It looks like all descendants of GitArchiveInputScheme already fall back to git+https for cloning: nix/github.cc at 3ae9467d57188f9db41f85b0e5c41c0c9d141955 · NixOS/nix · GitHub - it should be quite straightforward to implement a config parameter to forward all operations there.
ok, so it’s actually working, flakes will update the git repo to fetch the commit and extract nixpkgs from it to store it in the store, instead of downloading a tarball every time.
However, you have a 2.4 GB blob of git repository on each machine and it’s per user, if you accidentally run a flake using another user, the git repo will be downloaded as well.
I’d expect this to be managed by the nix-daemon and stored in /var/lib/ something on /nix/var/ something.
And if you use a fork of nixpkgs, it downloads the fork entirely, which is not cool
Well, there is no way of knowing which repo is a fork for which, so the only way to cache objects across all possible forks would be to have one huge local repo and fetch all remote repos into it, and that sounds scary.
As for fetching as different users, I wonder if there should be some way to to upload your flake into store and let daemon evaluate whatever you need. Like have a built-in builder that would evaluate flakes. That would also work nicer with IFDs, I think.