@@ -165,21 +165,23 @@ let
165165 buildPhase = ''
166166 runHook preBuild
167167
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
168+ if [[ -d "/nix/var/cache/sccache" && -w "/nix/var/cache/sccache" ]]; then
169+ # Test if sccache can actually write to the directory (sandbox check)
170+ if touch "/nix/var/cache/ sccache/.test" 2>/dev/null && rm -f "/nix/var/cache/sccache/.test" 2>/dev/null; then
171+ echo " sccache: cache directory available and writable in sandbox, enabling"
172+ export RUSTC_WRAPPER=" ${ sccache } /bin/sccache "
173+ export SCCACHE_DIR="/nix/var/cache /sccache"
174+ export SCCACHE_CACHE_SIZE="50G "
175+ ${ lib . optionalString stdenv . hostPlatform . isDarwin ''
176+ # On Darwin, use no-daemon mode to avoid cross-sandbox permission issues
177+ export SCCACHE_NO_DAEMON=1
178+ '' }
179179 else
180- echo "sccache: cache directory not available , skipping"
180+ echo "sccache: cache directory not accessible in sandbox (needs extra-sandbox-paths configuration) , skipping"
181181 fi
182- '' }
182+ else
183+ echo "sccache: cache directory not available, skipping"
184+ fi
183185
184186 echo "Executing cargo-pgrx buildPhase"
185187 ${ preBuildAndTest }
0 commit comments