feat(nix): add Cachix binary cache to CI#1237
feat(nix): add Cachix binary cache to CI#1237max-miller1204 wants to merge 1 commit intocjpais:mainfrom
Conversation
Replace magic-nix-cache (GitHub-local only) with cachix-action so build artifacts are pushed to a public binary cache. Nix users can then pull pre-built binaries instead of compiling from source (~25 min). Requires repo owner to: 1. Create the cache: cachix create handy 2. Add CACHIX_AUTH_TOKEN to GitHub repo secrets
|
LGTM! This would significantly reduce build times for Nix users — no more ~25 min compilations from source. I'm sure all Nix users will appreciate this. One note: @cjpais, this PR requires setup on your side before merging:
Once the cache is created, it would be great to add the substituter config with the public key to README.md so Nix users know how to enable it: nix.settings = {
substituters = [ "https://handy.cachix.org" ];
trusted-public-keys = [ "handy.cachix.org-1:<public key from step 1>" ];
}; |
|
I see. I didn't realize this is a paid hosting provider. I suspect the 5GB free tier might not be enough, anyone want to get me credits or a free plan? Happy to add them as a sponsor potentially. |
|
@cjpais The free 5GB tier should be more than enough. Here's why: Cachix doesn't store one big blob — it caches each dependency separately. When a user downloads handy, Cachix only serves the pieces that aren't already available from the default Nix package mirror ( So in practice, Cachix only needs to store handy itself (~67MB) and a few project-specific build artifacts. That's roughly 100-200MB per version — well within the 5GB free tier even with several versions cached. Old versions can be cleaned up with |
Summary
magic-nix-cache-action(GitHub-local cache only) withcachix/cachix-actionso build artifacts are pushed to a public Cachix binary cacheSetup required
cachix create handyCACHIX_AUTH_TOKENin the repo's GitHub Actions secretsThe NixOS module (
programs.handy) could also auto-add the substituter — happy to add that in a follow-up once the cache is created and the public key is known.