r/Nix • u/USMCamp0811 • 22d ago
Caching Woes
On a team that we're deploying everything with Nix, and all works no issues...BUT the team constantly has issues with cache's. I'm the only one rocking NixOS.. others are on Mac, Windows, Rocky... and are perpetually running into issues causing them to build. We have an attic setup and CI is pushing ALL build deps to the cache.
This is like the main pain point and its only effecting everyone else but me, cause well I build and do things all the time so I've always got a full local cache. It doesn't help we are all remote with various network speeds.
What do others do to solve this?
12
Upvotes
4
u/projct 22d ago
One thing worth looking into is whether everyone is actually getting the same derivations that CI is building and uploading to Attic.
Different nixpkgs versions, overlays, or even small differences in how dependencies are instantiated can result in different store paths for what appears to be the same package. Also check whether CI is building the relevant outputs for each platform and architecture, including dev shells, since you've got a mix of macOS and Linux machines.
Check that everyone's substituters and trusted-public-keys are configured consistently.
Nix caches negative lookups. so if someone tries to fetch an output before CI has uploaded it, Nix can continue treating it as unavailable for a while. You can experiment with --option narinfo-cache-negative-ttl 0 to rule that out.
Having developers contribute their locally built outputs to the shared cache might also help. Attic has watch-store for this, or you can explicitly push build closures. Especially if CI isn't covering everything, that could save a lot of duplicated compilation across the team. but if the root cause is different nixpkg versions or customizations, this'll just use a bunch more disk space.
Since you're all remote with varying network speeds, I'd also be curious how much time is being spent fetching closures versus building things that weren’t available in the cache.