From 57f145a7f8c3bd01e5ac1927cb0e1b14658fa7aa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 27 Nov 2013 12:41:43 +0100 Subject: [PATCH] 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. --- nixos/modules/services/misc/nix-daemon.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 1aefe75931b1..cca42aa11009 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -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 '';