For some reason that process is terribly slow, often only kB/s on my GBit network (attic even has a Postgres DB).
Building a docker image of the flake on GitHub with the help of nixos/nix:latest, docker pull it to my NAS and then serve /nix/store in the local network somehow.
I wasn’t able to build the flake in docker yet, because there is no nixos-rebuild and I was able to achieve it with nix itself.
rsync avh --delete /nix/store via SSH to my NAS from the first machine that downloaded the new derivations from the internet and serving it from the NAS somehow.
Storage size would be huge, because lots of generations would be synced.
I do all my building on there and all other machines use it as a substituter. Works great!
The only thing to watch out for is negative caching. If another machine tries to build something and finds it not in the local cache, it won’t query the local cache again for some time (even if you build the artifact there). You can reset the lookup cache by running
And an nginx server that serves that /var/lib/nixcache directory. Works out great as a local cache. Downloads are fast and zstd decompression is nice to have.
That said, I have been eying attic. It seems really nice. Just needs hydra integration maybe?
Yeah, thank you. Some day I will also need to put a NixOS box up in my LAN to always run
Thank you for the info about negative caching, I didn’t know that!
Thank you! Does Hyrda also run in a Docker container?
Attic is great, you can have multiple caches. Set them public or not public. Does deduplication on block level over all caches. Has a garbage collector. AND I have it running in a Docker container!
Thanks a lot for your blog posts! A proxy server that does the caching! Why didn’t I come up with that? You are keeping stuff for 60d, right? I wonder if I can directly build a Docker image from your config, or else I’d need to back-port it to be used with the conventional Nginx Docker image.
Of course nothing is ever found in the /var/public-nix-cache (/var/nix/public-nix-cache in my config), but after the 1st time a file is accessed it comes from cache.
@Solene, what purpose had /var/public-nix-cache for you? Did you put something there?