Skip to content

Commit 2575f60

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 2575f60

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed

.github/workflows/nix-build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,25 @@ 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+
144+
# Update Nix configuration to allow access to sccache directory in sandbox
145+
tee -a /etc/nix/nix.conf > /dev/null <<EOF
146+
extra-sandbox-paths = /nix/var/cache/sccache
147+
EOF
132148
- name: nix build
133149
if: ${{ matrix.attr != '' }}
134150
shell: bash
@@ -149,9 +165,25 @@ jobs:
149165
- name: Checkout Repo
150166
if: ${{ matrix.attr != '' }}
151167
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
168+
- name: Mount sccache disk
169+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
170+
uses: useblacksmith/stickydisk@v1
171+
with:
172+
key: ${{ github.repository }}-sccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.cache_key }}
173+
path: /nix/var/cache/sccache
152174
- name: Install nix
153175
if: ${{ matrix.attr != '' }}
154176
uses: ./.github/actions/nix-install-self-hosted
177+
- name: Configure sccache for Nix builds
178+
if: ${{ matrix.attr != '' && matrix.postgresql_version }}
179+
run: |
180+
# Ensure sccache directory exists
181+
mkdir -p /nix/var/cache/sccache
182+
183+
# Update Nix configuration to allow access to sccache directory in sandbox
184+
tee -a /etc/nix/nix.conf > /dev/null <<EOF
185+
extra-sandbox-paths = /nix/var/cache/sccache
186+
EOF
155187
- name: nix build
156188
if: ${{ matrix.attr != '' }}
157189
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)