Skip to content

Commit 9d96d24

Browse files
committed
ci: replace deprecated magic-nix-cache with cache-nix-action
magic-nix-cache (deprecated) uploaded the IaC closure path-by-path every run, adding a ~6min tail to each nix job. cache-nix-action restores by exact key and only saves on a miss (flake change), so unchanged-flake runs skip the upload. auto-optimise-store=false avoids the hardlink-restore bug; nix6 key for a clean cold build.
1 parent 62b8d25 commit 9d96d24

1 file changed

Lines changed: 85 additions & 16 deletions

File tree

.github/workflows/main.yml

Lines changed: 85 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,21 @@ jobs:
9191
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
9292
with:
9393
determinate: false
94-
# Substitutes individual store paths instead of tarring the whole
95-
# /nix/store, so store-optimisation hardlinks can't break a restore.
96-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
94+
# cache-nix-action tars and restores /nix/store verbatim; auto-optimise
95+
# hardlinks (/nix/store/.links) hit the tar's skip-list and fail to
96+
# relink on restore → partial store → missing-drv in nix-develop.
97+
extra-conf: |
98+
auto-optimise-store = false
99+
# Exact-key restore; saves (uploads) only on a miss — i.e. only when the
100+
# flake changes. Unchanged-flake runs restore and skip the upload entirely.
101+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
102+
with:
103+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
104+
purge: true
105+
purge-prefixes: nix6-${{ runner.os }}-
106+
purge-created: 0
107+
purge-last-accessed: 604800
108+
purge-primary-key: never
97109
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
98110
with:
99111
arguments: ./infrastructure
@@ -121,9 +133,21 @@ jobs:
121133
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
122134
with:
123135
determinate: false
124-
# Substitutes individual store paths instead of tarring the whole
125-
# /nix/store, so store-optimisation hardlinks can't break a restore.
126-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
136+
# cache-nix-action tars and restores /nix/store verbatim; auto-optimise
137+
# hardlinks (/nix/store/.links) hit the tar's skip-list and fail to
138+
# relink on restore → partial store → missing-drv in nix-develop.
139+
extra-conf: |
140+
auto-optimise-store = false
141+
# Exact-key restore; saves (uploads) only on a miss — i.e. only when the
142+
# flake changes. Unchanged-flake runs restore and skip the upload entirely.
143+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
144+
with:
145+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
146+
purge: true
147+
purge-prefixes: nix6-${{ runner.os }}-
148+
purge-created: 0
149+
purge-last-accessed: 604800
150+
purge-primary-key: never
127151
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
128152
with:
129153
arguments: ./infrastructure
@@ -150,9 +174,21 @@ jobs:
150174
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
151175
with:
152176
determinate: false
153-
# Substitutes individual store paths instead of tarring the whole
154-
# /nix/store, so store-optimisation hardlinks can't break a restore.
155-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
177+
# cache-nix-action tars and restores /nix/store verbatim; auto-optimise
178+
# hardlinks (/nix/store/.links) hit the tar's skip-list and fail to
179+
# relink on restore → partial store → missing-drv in nix-develop.
180+
extra-conf: |
181+
auto-optimise-store = false
182+
# Exact-key restore; saves (uploads) only on a miss — i.e. only when the
183+
# flake changes. Unchanged-flake runs restore and skip the upload entirely.
184+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
185+
with:
186+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
187+
purge: true
188+
purge-prefixes: nix6-${{ runner.os }}-
189+
purge-created: 0
190+
purge-last-accessed: 604800
191+
purge-primary-key: never
156192
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
157193
with:
158194
arguments: ./infrastructure
@@ -268,9 +304,21 @@ jobs:
268304
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
269305
with:
270306
determinate: false
271-
# Substitutes individual store paths instead of tarring the whole
272-
# /nix/store, so store-optimisation hardlinks can't break a restore.
273-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
307+
# cache-nix-action tars and restores /nix/store verbatim; auto-optimise
308+
# hardlinks (/nix/store/.links) hit the tar's skip-list and fail to
309+
# relink on restore → partial store → missing-drv in nix-develop.
310+
extra-conf: |
311+
auto-optimise-store = false
312+
# Exact-key restore; saves (uploads) only on a miss — i.e. only when the
313+
# flake changes. Unchanged-flake runs restore and skip the upload entirely.
314+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
315+
with:
316+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
317+
purge: true
318+
purge-prefixes: nix6-${{ runner.os }}-
319+
purge-created: 0
320+
purge-last-accessed: 604800
321+
purge-primary-key: never
274322
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
275323
with:
276324
arguments: ./infrastructure
@@ -333,8 +381,17 @@ jobs:
333381
if: matrix.image.needs_build_secrets
334382
with:
335383
determinate: false
336-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
384+
extra-conf: |
385+
auto-optimise-store = false
386+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
337387
if: matrix.image.needs_build_secrets
388+
with:
389+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
390+
purge: true
391+
purge-prefixes: nix6-${{ runner.os }}-
392+
purge-created: 0
393+
purge-last-accessed: 604800
394+
purge-primary-key: never
338395
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
339396
if: matrix.image.needs_build_secrets
340397
with:
@@ -402,9 +459,21 @@ jobs:
402459
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
403460
with:
404461
determinate: false
405-
# Substitutes individual store paths instead of tarring the whole
406-
# /nix/store, so store-optimisation hardlinks can't break a restore.
407-
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
462+
# cache-nix-action tars and restores /nix/store verbatim; auto-optimise
463+
# hardlinks (/nix/store/.links) hit the tar's skip-list and fail to
464+
# relink on restore → partial store → missing-drv in nix-develop.
465+
extra-conf: |
466+
auto-optimise-store = false
467+
# Exact-key restore; saves (uploads) only on a miss — i.e. only when the
468+
# flake changes. Unchanged-flake runs restore and skip the upload entirely.
469+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
470+
with:
471+
primary-key: nix6-${{ runner.os }}-${{ hashFiles('infrastructure/flake.nix', 'infrastructure/flake.lock') }}
472+
purge: true
473+
purge-prefixes: nix6-${{ runner.os }}-
474+
purge-created: 0
475+
purge-last-accessed: 604800
476+
purge-primary-key: never
408477
- uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1
409478
with:
410479
arguments: ./infrastructure

0 commit comments

Comments
 (0)