Back in 2020, we introduced upstream caches - a feature that avoids pushing store paths already present in cache.nixos.org. At the time, we mentioned:
In the future you are going to define upstream caches within Cachix so that the typical setup of a private and public cache does not duplicate the entries between the two.
That future is now.
What’s New
The simple boolean setting has been replaced with a configurable list of upstream caches. You can now add:
- cache.nixos.org - the official NixOS binary cache
- Any public Cachix cache - like
nix-community,devenv, or your own organization’s caches
This means if you have a public cache for open source and a private cache for proprietary builds, the private cache can now use your public cache as an upstream - no more duplicate store paths.
How It Works
When you push store paths to Cachix, the client queries which paths already exist. With configurable upstream caches, paths present in any of your configured upstreams are filtered out from the response, so they won’t be uploaded.
For cache.nixos.org, we query the cache directly with caching. For other Cachix caches, the check happens server-side by looking up existing narinfos in our database.
Configuration
Head to your binary cache’s Settings > General page. You’ll find a new “Upstream caches” section where you can:
- Add any Cachix cache by name
- Use quick-add buttons for popular caches (cache.nixos.org, nix-community, devenv)
- Remove upstream caches you no longer need
New caches automatically get cache.nixos.org configured as a default upstream.
Use Cases
Multi-tier caching: A company with mycompany (public, OSS) and mycompany-private caches can set mycompany as an upstream for mycompany-private. Internal builds won’t re-upload dependencies already in the public cache.
Community collaboration: If your project depends heavily on nix-community packages, adding it as an upstream saves bandwidth and storage.
Avoiding duplication: The most common case - simply not uploading store paths that already exist in cache.nixos.org, which has always been the default behavior.
Happy caching!