11# Nix Caching Setup
22
3- This repository uses multiple caching strategies for optimal CI/CD performance.
3+ This repository uses ** 5 free caching layers** for maximum performance and availability.
4+
5+ ## Multi-Cache Strategy
6+
7+ The flake automatically tries caches in order:
8+ 1 . ** cache.nixos.org** (official, always first)
9+ 2 . ** nix-community.cachix.org** (community cache, high hit rate)
10+ 3 . ** cache.garnix.io** (Garnix CI cache, automatic builds)
11+ 4 . ** singularity-ng.cachix.org** (our cache)
12+ 5 . ** Magic Nix Cache** (GitHub Actions only)
13+
14+ All caches are ** FREE** and configured automatically!
415
516## Caching Layers
617
7- ### 1. Cachix Binary Cache
18+ ### 1. Nix Community Cache
19+ ** Public cache** : ` nix-community.cachix.org `
20+
21+ - ** Free** : Unlimited usage
22+ - ** High hit rate** : Common Nix packages cached
23+ - ** Fast** : CDN-backed
24+ - ** Auto-configured** in flake.nix
25+
26+ No setup needed - already configured!
27+
28+ ### 2. Garnix Cache
29+ ** Public cache** : ` cache.garnix.io `
30+
31+ - ** Free** : Unlimited usage
32+ - ** Automatic** : Builds all flake outputs
33+ - ** No config** : Just enable Garnix on GitHub
34+ - ** Dashboard** : https://garnix.io
35+
36+ Enable at: https://garnix.io (GitHub App)
37+
38+ Configuration: ` garnix.yaml ` (root of repo)
39+
40+ ### 3. Cachix (Org Cache)
841** Public cache** : ` singularity-ng `
942
1043Stores:
@@ -21,22 +54,19 @@ nix-env -iA cachix -f https://cachix.org/api/v1/install
2154cachix use singularity-ng
2255```
2356
24- Or add to ` ~/.config/nix/nix.conf ` :
25- ```
26- substituters = https://cache.nixos.org https://singularity-ng.cachix.org
27- trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= singularity-ng.cachix.org-1:your-signing-key-here
28- ```
57+ Or already configured in flake.nix!
2958
30- ### 2 . Magic Nix Cache
59+ ### 4 . Magic Nix Cache
3160** GitHub Actions** : Automatic caching via ` magic-nix-cache-action `
3261
3362Benefits:
3463- Zero configuration
3564- Automatic cache invalidation
3665- Works across workflow runs
3766- Free for public repos
67+ - ~ 90% cache hit rate
3868
39- ### 3 . FlakeHub
69+ ### 5 . FlakeHub
4070** Flake registry** : Published flake for easy consumption
4171
4272Use in your ` flake.nix ` :
0 commit comments