@@ -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
0 commit comments