33 workflow_dispatch :
44
55env :
6- pin_nixpkgs : nix registry pin nixpkgs github:NixOS/nixpkgs/807c549feabce7eddbf259dbdcec9e0600a0660d
6+ pin_nixpkgs : nix registry pin nixpkgs github:NixOS/nixpkgs/def3da69945bbe338c373fddad5a1bb49cf199ce
77 # required for gh
88 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99
10+ nix_conf : |
11+ substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io
12+ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
13+ keep-env-derivations = true
14+ keep-outputs = true
15+ nix_conf_ca_derivations : |
16+ extra-experimental-features = ca-derivations
17+
1018jobs :
1119 # Build the action
1220 # Commit and push the built code
2230 submodules : true
2331
2432 - uses : nixbuild/nix-quick-install-action@v34
33+ with :
34+ # We don't enable ca-derivations here
35+ # because we have later jobs where ca-derivations is enabled.
36+ nix_conf : ${{ env.nix_conf }}
2537
26- - name : Restore and save Nix store
38+ - name : Restore and save Nix store and npm cache
2739 uses : ./.
2840 with :
2941 primary-key : build-${{ runner.os }}-${{ hashFiles('**/package-lock.json', 'package.json', 'flake.nix', 'flake.lock') }}
3749 purge-created : 0
3850 # except the version with the `primary-key`, if it exists
3951 purge-primary-key : never
52+ # and collect garbage in the Nix store until it reaches this size in bytes
53+ gc-max-store-size : 0
4054 # use BuildJet backend
4155 backend : buildjet
4256
@@ -65,10 +79,13 @@ jobs:
6579 run : |
6680 git add dist
6781 git commit -m "chore: build the action" || echo "Nothing to commit"
68- git add .
82+ git add {.,save,restore}/{*.yml,*.md}
6983 git commit -m "chore: update docs" || echo "Nothing to commit"
7084 git push
7185
86+ - name : Save flake attributes from garbage collection
87+ run : nix profile install .#saveFromGC
88+
7289 # Make `individual` caches
7390 # Restore `individual` or `common` caches
7491 # Usually, there should be no `individual` caches to restore as they're purged by `merge-similar-caches`
8198 matrix :
8299 os :
83100 - macos-14
84- - macos-14
101+ - macos-15
85102 - ubuntu-22.04
86103 - ubuntu-24.04
87104 id :
@@ -101,7 +118,18 @@ jobs:
101118 }}
102119
103120 - uses : nixbuild/nix-quick-install-action@v34
104-
121+ with :
122+ # Make caches with ca-derivations enabled on some machines
123+ # to test merging stores where the feature is enabled for one store and disabled for another.
124+ # Don't enable it on some machines at all
125+ # to test merging stores with that feature disabled.
126+ nix_conf : |
127+ ${{ env.nix_conf }}
128+ ${{ (
129+ (matrix.id == 1 && matrix.os == 'ubuntu-22.04') ||
130+ (matrix.id == 2 && matrix.os == 'ubuntu-24.04')
131+ ) && env.nix_conf_ca_derivations || ''
132+ }}
105133 - name : Restore Nix store - ${{ matrix.id }}
106134 id : restore
107135 uses : ./restore
@@ -136,6 +164,8 @@ jobs:
136164 purge-created : 0
137165 # except the version with the `primary-key`, if it exists
138166 purge-primary-key : never
167+ # and collect garbage in the Nix store until it reaches this size in bytes
168+ gc-max-store-size : 8G
139169 # use BuildJet backend
140170 backend : buildjet
141171
@@ -151,7 +181,7 @@ jobs:
151181 matrix :
152182 os :
153183 - macos-14
154- - macos-14
184+ - macos-15
155185 - ubuntu-22.04
156186 - ubuntu-24.04
157187 runs-on : ${{ matrix.os }}
@@ -168,6 +198,12 @@ jobs:
168198 }}
169199
170200 - uses : nixbuild/nix-quick-install-action@v34
201+ with :
202+ # We enable ca-derivations only on macos-15
203+ # to test more different cases.
204+ nix_conf : |
205+ ${{ env.nix_conf }}
206+ ${{ matrix.os == 'macos-15' && env.nix_conf_ca_derivations || '' }}
171207
172208 - name : Restore and save Nix store
173209 uses : ./.
@@ -227,7 +263,7 @@ jobs:
227263 matrix :
228264 os :
229265 - macos-14
230- - macos-14
266+ - macos-15
231267 - ubuntu-22.04
232268 - ubuntu-24.04
233269 runs-on : ${{ matrix.os }}
@@ -244,6 +280,12 @@ jobs:
244280 }}
245281
246282 - uses : nixbuild/nix-quick-install-action@v34
283+ with :
284+ # We enable ca-derivations only on macos-15
285+ # to test more different cases.
286+ nix_conf : |
287+ ${{ env.nix_conf }}
288+ ${{ matrix.os == 'macos-15' && env.nix_conf_ca_derivations || '' }}
247289
248290 - name : Restore Nix store
249291 uses : ./restore
@@ -295,7 +337,7 @@ jobs:
295337 - false
296338 os :
297339 - macos-14
298- - macos-14
340+ - macos-15
299341 - ubuntu-22.04
300342 - ubuntu-24.04
301343 runs-on : ${{ matrix.os }}
@@ -311,7 +353,22 @@ jobs:
311353 || format('git pull --rebase origin {0}', github.ref_name)
312354 }}
313355
356+ # adapted from https://github.com/nodejs/node/pull/54658
357+ - name : Cleanup
358+ run : |
359+ echo "::group::Free space before cleanup"
360+ df -h
361+ echo "::endgroup::"
362+ echo "::group::Cleaned Files"
363+ sudo rm -rfv ${{ runner.os == 'Linux' && '/usr/local/lib/android' || '/Users/runner/Library/Android/sdk' }}
364+ echo "::endgroup::"
365+ echo "::group::Free space after cleanup"
366+ df -h
367+ echo "::endgroup::"
368+
314369 - uses : nixbuild/nix-quick-install-action@v34
370+ with :
371+ nix_conf : ${{ env.nix_conf }}
315372
316373 - name : Restore and save Nix store
317374 if : matrix.do-cache
@@ -330,7 +387,7 @@ jobs:
330387 # except the version with the `primary-key`, if it exists
331388 purge-primary-key : never
332389 # and collect garbage in the Nix store until it reaches this size in bytes
333- gc-max-store-size : 8000000000
390+ gc-max-store-size : 0
334391 # use BuildJet backend
335392 backend : buildjet
336393
@@ -347,47 +404,48 @@ jobs:
347404 - name : List registry
348405 run : nix registry list
349406
350- - name : Install nixpkgs
407+ - name : Save nixpkgs from garbage collection
408+ # About nixpkgs#path
409+ # https://github.com/NixOS/nixpkgs/issues/270292
351410 run : nix profile install $(nix flake archive nixpkgs --json | jq -r '.path')
352411
353412 - name : Show profile
354413 run : nix profile list
355414
356415 - name : Install nixpkgs#hello
357- run : |
358- nix profile install nixpkgs#hello
416+ run : nix profile install nixpkgs#hello
359417
360418 - name : Install nixpkgs#cachix
361- run : |
362- nix profile install nixpkgs#cachix
419+ run : nix profile install nixpkgs#cachix
363420
364421 - name : Install nixpkgs#nixpkgs-fmt
365- run : |
366- nix profile install nixpkgs#nixpkgs-fmt
422+ run : nix profile install nixpkgs#nixpkgs-fmt
367423
368424 - name : Install nixpkgs#alejandra
369- run : |
370- nix profile install nixpkgs#alejandra
425+ run : nix profile install nixpkgs#alejandra
371426
372427 - name : Install nixpkgs#nixd
373- run : |
374- nix profile install nixpkgs#nixd
428+ run : nix profile install nixpkgs#nixd
375429
376430 - name : Install nixpkgs#ghc
377- run : |
378- nix profile install nixpkgs#ghc
431+ run : nix profile install nixpkgs#ghc
379432
380433 - name : Install nixpkgs#haskell-language-server
381- run : |
382- nix profile install nixpkgs#haskell-language-server
434+ run : nix profile install nixpkgs#haskell-language-server
383435
384436 - name : Install nixpkgs#purescript
385- run : |
386- nix profile install nixpkgs#purescript
437+ run : nix profile install nixpkgs#purescript
387438
388439 - name : Install nixpkgs#nodejs
389- run : |
390- nix profile install nixpkgs#nodejs
440+ run : nix profile install nixpkgs#nodejs
391441
392442 - name : Show profile
393443 run : nix profile list
444+
445+ test-collision-produce :
446+ needs : build
447+ uses : ./.github/workflows/test-hash-collision.yml
448+
449+ test-collision-consume :
450+ needs : test-collision-produce
451+ uses : ./.github/workflows/test-hash-collision.yml
0 commit comments