The idea behind niks3 is to allow clients to upload nix store paths to S3-compatible storage while tracking uploads on a server for later garbage collection.
This makes it easy to achieve high availability for reading from the binary cache, since this is a solved problem among S3 providers.
With so many providers to choose from, it also becomes quite cheap to host larger caches.
Additionally, niks3 opens the door to features that are missing in the current binary cache ecosystem.
For example, there is an open pull request to add OIDC support,
which would allow providing upload access to binary caches from CIs without handing out long-lived tokens.
This sounds cool! I would like to setup a binary cache for riscv64 nixpkgs-25.11 stable. would this be possible to achieve with niks3? what would i need for this?
Additionally, niks3 opens the door to features that are missing in the current binary cache ecosystem.
For example, there is an open pull request to add OIDC support
Yeah. That’s nice. Only bummer is that one still needs to put the signing key into CI, whereas niks3 keeps this in the server. OIDC support was now merged. Docs are here: Home · Mic92/niks3 Wiki · GitHub
Very cool to have built-in oidc support, I had to hack together a vault server and configure attic to use its ECDSA signing key to get short lived tokens working. I would’ve loved to skip all of that.
Does it also provide similar de-duplication and filtering features (to only cache things not present in a set of upstream caches, for example)?
No, nix doesn’t support de-duplication in the binary cache protocol and it’s goal is to be directly compatible with it. I have to do more measurement, but so far I have not seen too many space saving from the deduplication algorithm, I tried. Regarding the filtering, it’s also something I rather not want to add because:
s3 storage can actually be rather cheap (6 Dollar / TB is a lot of cache)
I noticed that serving from my cache with zstd compression is faster than cache.nixos.org
We want to garbage collect https://cache.nixos.org hopefully starting next year and Nix really doesn’t like it if you leave invalid references - I don’t want to have niks3 users having a broken cache.