Skip to content

Commit 2867387

Browse files
committed
fix(sccache): use NIX_BUILD_TOP for temp files on darwin with __noChroot
1 parent df05ff2 commit 2867387

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

nix/cargo-pgrx/buildPgrxExtension.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ let
176176
if touch "/nix/var/cache/sccache/.test" 2>/dev/null && rm -f "/nix/var/cache/sccache/.test" 2>/dev/null; then
177177
echo "sccache: cache directory available and writable, enabling"
178178
${lib.optionalString stdenv.isDarwin ''
179-
# Darwin: use /tmp for temp files (allowed by sandbox-defaults.sb)
180-
export TMPDIR=/tmp
181-
export TEMP=/tmp
182-
export TEMPDIR=/tmp
183-
export TMP=/tmp
179+
# Darwin: use build directory for temp files (nixbld user owns it with __noChroot)
180+
export TMPDIR="$NIX_BUILD_TOP/sccache-tmp"
181+
export TEMP="$NIX_BUILD_TOP/sccache-tmp"
182+
export TEMPDIR="$NIX_BUILD_TOP/sccache-tmp"
183+
export TMP="$NIX_BUILD_TOP/sccache-tmp"
184+
mkdir -p "$TMPDIR"
184185
''}
185186
export RUSTC_WRAPPER="${sccache}/bin/sccache"
186187
export SCCACHE_DIR="/nix/var/cache/sccache"

0 commit comments

Comments
 (0)