Multi-branch flake update performance improvement?

Hello, in my flake.nix I’m using 4 different nixpkgs branches. When I do a nix flake update each one downloads around 28M of data rather slowly from github. I’m looking for suggestions on how I might improve that.

I have a local checkout of nixpkgs, and I suppose I could point the branches to there in flake.nix file, but I’d prefer something that continued to work without a local checkout.

Perhaps there’s some way to push branches from the local checkout to the store before doing the flake update? Or maybe someone would recommend a supported git proxy setup?

1 Like

Haha only 4? The main work project I’m responsible for now has 102 references to different revisions of nixpkgs in the lock file :laughing:

It’s a problem that I hope will be addressed eventually. There’s a lot of ways it could be handled. I’ve opened a few issues upstream to explore some ideas:
https://github.com/NixOS/nix/issues/4602
https://github.com/NixOS/nix/issues/5576

I also wrote a simple POC module for the first idea, but the downside is that it rewrites the lockfile entries to point to your local checkout so it’s not easily reusable by other consumers of your flake. It was moreso to demonstrate that the idea could work in prinicple (especially since a lot of Nix users tend to keep a copy of nixpkgs locally anyway):

Setting up some sort of proxy to reroute requests to nixpkgs to a local checkout is an interesting idea as well, and is something I’ve been wanting to try too, but I’ve just had no time. Hopefully someday there will be an officially supported solution besides just downloading a ton of stuff from GitHub.

5 Likes