File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -165,15 +165,21 @@ let
165165 buildPhase = ''
166166 runHook preBuild
167167
168-
169- if [[ -d "/nix/var/cache/sccache" && -w "/nix/var/cache/sccache" ]]; then
170- echo "sccache: cache directory available, enabling"
171- export RUSTC_WRAPPER="${ sccache } /bin/sccache"
172- export SCCACHE_DIR="/nix/var/cache/sccache"
173- export SCCACHE_CACHE_SIZE="50G"
174- else
175- echo "sccache: cache directory not available, skipping"
176- fi
168+ ${ lib . optionalString ( ! stdenv . hostPlatform . isDarwin ) ''
169+ if [[ -d "/nix/var/cache/sccache" && -w "/nix/var/cache/sccache" ]]; then
170+ # Test if sccache can actually write to the directory (sandbox check)
171+ if touch "/nix/var/cache/sccache/.test" 2>/dev/null && rm -f "/nix/var/cache/sccache/.test" 2>/dev/null; then
172+ echo "sccache: cache directory available and writable in sandbox, enabling"
173+ export RUSTC_WRAPPER="${ sccache } /bin/sccache"
174+ export SCCACHE_DIR="/nix/var/cache/sccache"
175+ export SCCACHE_CACHE_SIZE="50G"
176+ else
177+ echo "sccache: cache directory not accessible in sandbox (needs extra-sandbox-paths configuration), skipping"
178+ fi
179+ else
180+ echo "sccache: cache directory not available, skipping"
181+ fi
182+ '' }
177183
178184 echo "Executing cargo-pgrx buildPhase"
179185 ${ preBuildAndTest }
You can’t perform that action at this time.
0 commit comments