When setting $NIX_REMOTE, check whether /nix/var/nix/db is writable

In NixOS containers, root doesn't have write permission to
/nix/var/nix/db, so it has to use the daemon.
This commit is contained in:
Eelco Dolstra 2013-11-27 12:41:43 +01:00
parent c6529ac9eb
commit 57f145a7f8

View File

@ -334,10 +334,8 @@ in
''
# Set up secure multi-user builds: non-root users build through the
# Nix daemon.
if test "$USER" != root; then
if [ "$USER" != root -o ! -w /nix/var/nix/db ]; then
export NIX_REMOTE=daemon
else
export NIX_REMOTE=
fi
'';