Skip to content

Commit 7aa3271

Browse files
committed
ci: cache gnu32 nix store
1 parent 22bec91 commit 7aa3271

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
runs-on: ubuntu-latest
131131

132132
env:
133+
NIXPKGS_CHANNEL: nixos-25.05
133134
NIX_EXTRA_CONFIG_ACT: |
134135
sandbox = false
135136
filter-syscalls = false
@@ -147,12 +148,25 @@ jobs:
147148
- name: Install Nix
148149
uses: cachix/install-nix-action@v31 # 2025-05-27, from https://github.com/cachix/install-nix-action/tags
149150
with:
150-
nix_path: nixpkgs=channel:nixos-25.05 # latest release
151+
nix_path: nixpkgs=channel:${{ env.NIXPKGS_CHANNEL }} # latest release
151152
# Act executes inside an unprivileged container (Docker or Podman),
152153
# so KVM support isn't available.
153154
enable_kvm: "${{ github.actor != 'nektos/act' }}"
154155
extra_nix_config: ${{ github.actor == 'nektos/act' && env.NIX_EXTRA_CONFIG_ACT || '' }}
155156

157+
# Cache the heaviest Nix job to stay within GitHub's cache budget while
158+
# still avoiding repeated gnu32 cross-toolchain downloads and builds.
159+
- name: Cache Nix store
160+
if: matrix.config == 'gnu32'
161+
uses: nix-community/cache-nix-action@v7
162+
with:
163+
primary-key: nix-${{ runner.os }}-${{ matrix.config }}-${{ env.NIXPKGS_CHANNEL }}-${{ hashFiles('shell.nix', 'ci/patches/*.patch', 'ci/configs/gnu32.bash') }}
164+
restore-prefixes-first-match: |
165+
nix-${{ runner.os }}-${{ matrix.config }}-${{ env.NIXPKGS_CHANNEL }}-
166+
nix-${{ runner.os }}-${{ matrix.config }}-
167+
nix-${{ runner.os }}-
168+
gc-max-store-size-linux: 3G
169+
156170
- name: Run CI script
157171
env:
158172
CI_CONFIG: ci/configs/${{ matrix.config }}.bash

0 commit comments

Comments
 (0)