Skip to content

Commit 7472bcb

Browse files
committed
feat: enable sccache for Darwin runners
Configure sccache on aarch64-darwin self-hosted runners with persistent cache disk mounting and Nix sandbox access via extra-sandbox-paths. Use jfroche/nix-eval-jobs fork with its own nixpkgs to maintain compatibility with existing warning fixes while avoiding lowdown build issues.
1 parent dd9bf74 commit 7472bcb

File tree

3 files changed

+54
-16
lines changed

3 files changed

+54
-16
lines changed

.github/workflows/nix-build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,26 @@ jobs:
126126
- name: Checkout Repo
127127
if: ${{ matrix.attr != '' }}
128128
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
129+
- name: Mount sccache disk
130+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
131+
uses: useblacksmith/stickydisk@v1
132+
with:
133+
key: ${{ github.repository }}-sccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.cache_key }}
134+
path: /nix/var/cache/sccache
129135
- name: Install nix
130136
if: ${{ matrix.attr != '' }}
131137
uses: ./.github/actions/nix-install-self-hosted
138+
- name: Configure sccache for Nix builds
139+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
140+
run: |
141+
# Ensure sccache directory exists
142+
mkdir -p /nix/var/cache/sccache
143+
# Update Nix configuration to allow access to sccache directory in sandbox
144+
if [ -w /etc/nix/nix.conf ]; then
145+
tee -a /etc/nix/nix.conf > /dev/null <<EOF
146+
extra-sandbox-paths = /nix/var/cache/sccache
147+
EOF
148+
fi
132149
- name: nix build
133150
if: ${{ matrix.attr != '' }}
134151
shell: bash
@@ -149,9 +166,26 @@ jobs:
149166
- name: Checkout Repo
150167
if: ${{ matrix.attr != '' }}
151168
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
169+
- name: Mount sccache disk
170+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
171+
uses: useblacksmith/stickydisk@v1
172+
with:
173+
key: ${{ github.repository }}-sccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.cache_key }}
174+
path: /nix/var/cache/sccache
152175
- name: Install nix
153176
if: ${{ matrix.attr != '' }}
154177
uses: ./.github/actions/nix-install-self-hosted
178+
- name: Configure sccache for Nix builds
179+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
180+
run: |
181+
# Ensure sccache directory exists
182+
mkdir -p /nix/var/cache/sccache
183+
# Update Nix configuration to allow access to sccache directory in sandbox
184+
if [ -w /etc/nix/nix.conf ]; then
185+
tee -a /etc/nix/nix.conf > /dev/null <<EOF
186+
extra-sandbox-paths = /nix/var/cache/sccache
187+
EOF
188+
fi
155189
- name: nix build
156190
if: ${{ matrix.attr != '' }}
157191
shell: bash

flake.lock

Lines changed: 19 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
nix-editor.url = "github:snowfallorg/nix-editor";
2121
nix-eval-jobs.inputs.flake-parts.follows = "flake-parts";
2222
nix-eval-jobs.inputs.treefmt-nix.follows = "treefmt-nix";
23-
nix-eval-jobs.url = "github:nix-community/nix-eval-jobs";
23+
nix-eval-jobs.url = "github:jfroche/nix-eval-jobs/fix-warnings";
2424
nix2container.inputs.nixpkgs.follows = "nixpkgs";
2525
nix2container.url = "github:nlewo/nix2container";
2626
# Pin to a specific nixpkgs version that has compatible v8 and curl versions

0 commit comments

Comments
 (0)