Introducing peerix - Share your nix-store between your computers

If you have more than one system at home running Nix, you probably ran into a simple problem: You’re constantly re-downloading the same packages again and again.

One solution is a pull-through cache, another one is running nix-serve or similar solutions from a central server. But in smaller networks, especially between client-computers and especially laptops, it might not be feasible to add a central cache to your nix config.

This is why I wrote peerix. It runs a binary cache service on each of your computer and communicates with other peerix-instances in the same network so each installation can pull from each others’ nix-store.

Check it out here: GitHub

P.S. I literally hacked it together during the weekend, so please bear with it being very simple right now.

22 Likes

Wow. This is really cool. I always wanted to have something like this. How do you discover other instances? This is a previous attempt for this type of binary cache: GitHub - andir/local-nix-cache: A poor and hacky attempt at re-serving local nix packages that came from trusted sources

I just send a UDP-broadcast to all networks with IP-Addresses in private network ranges for each package.

I think andir also registered an ipv6 multicast address at IANA just for nix-caches.

1 Like

Interesting.

As far as I see it, andir never used the multicast-address. I kinda don’t want to repurpose their registered address unilaterally. Can I get somehow in touch with andir?

@andi:kack.it on matrix or via email: https://github.com/NixOS/nixpkgs/blob/073fe478e1ba748731d537bd38eac0969f503143/maintainers/maintainer-list.nix#L670

Contact me on some real-time communication thing and we can coordinate the usage of that. Thanks for working on this I kind ran out of motivation / time.

IRC: andi- (hacking, libera, oftc, …)
Matrix: @andi:kack.it

6 Likes

This looks really promising.

Can anyone who’s used it outline a quick how-to? What pre-requisites are there?

1 Like