@@ -168,20 +168,25 @@ let
168168 echo "Platform: ${ stdenv . system } "
169169 echo "isDarwin: ${ lib . boolToString stdenv . isDarwin } "
170170
171- # sccache doesn't work in Nix Darwin sandbox due to temporary directory restrictions
172- if [[ "${ lib . boolToString stdenv . isDarwin } " != "true" && -d "/nix/var/cache/sccache" && -w "/nix/var/cache/sccache" ]]; then
173- # Test if sccache can actually write to the directory (sandbox check)
171+ # Configure sccache based on platform
172+ if [[ -d "/nix/var/cache/sccache" && -w "/nix/var/cache/sccache" ]]; then
174173 if touch "/nix/var/cache/sccache/.test" 2>/dev/null && rm -f "/nix/var/cache/sccache/.test" 2>/dev/null; then
175- echo "sccache: cache directory available and writable in sandbox, enabling"
174+ ${ lib . optionalString stdenv . isDarwin ''
175+ echo "sccache: Darwin detected, configuring with /tmp for temporary files"
176+ export TMPDIR=/tmp
177+ '' }
178+ ${ lib . optionalString ( ! stdenv . isDarwin ) ''
179+ echo "sccache: Linux detected, cache directory available and writable in sandbox, enabling"
180+ '' }
176181 export RUSTC_WRAPPER="${ sccache } /bin/sccache"
177182 export SCCACHE_DIR="/nix/var/cache/sccache"
178183 export SCCACHE_CACHE_SIZE="50G"
179184 export SCCACHE_LOG=debug
180185 else
181- echo "sccache: cache directory not accessible in sandbox (needs extra-sandbox-paths configuration) , skipping"
186+ echo "sccache: cache directory not accessible in sandbox, skipping"
182187 fi
183188 else
184- echo "sccache: not available or running on Darwin , skipping"
189+ echo "sccache: cache directory not available , skipping"
185190 fi
186191
187192 echo "Executing cargo-pgrx buildPhase"
0 commit comments