Skip to content

Commit 21d0055

Browse files
dannyfarisclaude
andauthored
ci: add cache-nix-action for store-path caching across cold runs (#61) (#151)
Amortise the non-niri half of the desktop closure (Quickshell, Qt6, matugen, DMS, xwayland-satellite, foot and transitive deps) that a fresh GH Actions runner otherwise rebuilds every cold run. Output-cache storage (actions/cache-shaped), orthogonal to the niri.cachix.org substituter trust lines (#59). Keyed on os × arch × flake.lock hash; PR branches restore from the os×arch prefix seeded on main. GC to 5G before save keeps both arch entries under the 10 GB per-repo limit; a 7-day last-accessed purge sweeps dead prefixes without evicting the run's own primary key. cache-nix-action chosen over Cachix/FlakeHub/Attic per the issue's trust-delegation reasoning; revisit only if hit rate stays below ~60% over a month or a second major source-built dep arrives. https://claude.ai/code/session_01R9nbBuTjy2rkiMYJ6NJ1G1 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7a6c703 commit 21d0055

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,36 @@ jobs:
7878
extra-substituters = https://niri.cachix.org
7979
extra-trusted-public-keys = niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=
8080
81+
# Store-path cache across cold runs (ADR-028 slice-3 follow-up, #61).
82+
# This is `actions/cache`-shaped storage for build *outputs* — it is
83+
# NOT a substituter, and is orthogonal to the niri.cachix.org trust
84+
# lines above (#59). It amortises the non-niri half of the desktop
85+
# closure that a fresh runner otherwise rebuilds every cold run:
86+
# Quickshell + Qt6 + matugen + DMS + xwayland-satellite + foot and
87+
# their transitive deps.
88+
#
89+
# Why this and not Cachix/FlakeHub/Attic: those are larger trust or
90+
# operational delegations than a one-operator / three-host project
91+
# warrants today. `cache-nix-action` first; revisit Cachix/Attic only
92+
# if hit rate stays below ~60% over a month or a second major
93+
# source-built dep arrives (#61 "Triggers to revisit").
94+
#
95+
# Key semantics: keyed on os × arch × flake.lock hash, so a lock bump
96+
# invalidates cleanly. PR branches restore from the os×arch prefix
97+
# seeded on main — the squash-auto-merge flow reseeds the cache after
98+
# each PR lands. GC before save (5G ceiling) keeps x86_64 + aarch64
99+
# entries coexisting under the 10 GB per-repo limit; a 7-day
100+
# last-accessed purge sweeps dead prefix entries without ever purging
101+
# the run's own primary key.
102+
- uses: nix-community/cache-nix-action@v6
103+
with:
104+
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock') }}
105+
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}-
106+
gc-max-store-size-linux: 5G
107+
purge: true
108+
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}-
109+
purge-created: 0 # no created-age gate; last-accessed is the real filter
110+
purge-last-accessed: 604800
111+
purge-primary-key: never
112+
81113
- run: nix flake check --print-build-logs

0 commit comments

Comments
 (0)