Skip to content

Commit

Permalink
On macOS, don't use /var/folders for TMPDIR
Browse files Browse the repository at this point in the history
This broke "nix-store --serve".

(cherry picked from commit 25230a1)
  • Loading branch information
edolstra committed Jun 12, 2017
1 parent c338545 commit 36f363b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libmain/shared.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ void initNix()

if (char *pack = getenv("_NIX_OPTIONS"))
settings.unpack(pack);

/* On macOS, don't use the per-session TMPDIR (as set e.g. by
sshd). This breaks build users because they don't have access
to the TMPDIR, in particular in ‘nix-store --serve’. */
#if __APPLE__
if (getuid() == 0 && hasPrefix(getEnv("TMPDIR"), "/var/folders/"))
unsetenv("TMPDIR");
#endif
}


Expand Down

0 comments on commit 36f363b

Please sign in to comment.