Nixpkgs: Cannot use nix-env from a user account

Created on 11 Jan 2015  Â·  8Comments  Â·  Source: NixOS/nixpkgs

All of this is with mutableUsers = false:

The following error is thrown:

error: Nix database directory ‘/nix/var/nix/db’ is not writable: Permission denied

It works, once I manually set

export NIX_REMOTE=daemon

So this probably needs to be set somewhere.

Most helpful comment

After upgrading to the pre-release version of 18.03, i've got a similar issue in bash, but with nix-repl instead of nix-env. Using export NIX_REMOTE=daemon helped... How can i fix this?

All 8 comments

You are probably using a shell that does not honor /etc/profile.

On Sun, Jan 11, 2015 at 8:10 PM, Profpatsch [email protected]
wrote:

All of this is with mutableUsers = false:

The following error is thrown:

error: Nix database directory ‘/nix/var/nix/db’ is not writable: Permission denied

It works, once I manually set

export NIX_REMOTE=daemon

So this probably needs to be set somewhere.

—
Reply to this email directly or view it on GitHub
https://github.com/NixOS/nixpkgs/issues/5713.

NixOS Linux http://nixos.org

Indeed, zsh does not load /etc/profile by default, but it does /etc/zprofile.

What would be the sensible way to go? Link profile to zprofile when installing the zsh package?

I think the overall level of support for non-bash shells (as the default user shell) is rather low ATM.

If you are on NixOS, you must set programs.zsh.enable = true to generate the correct profile for zsh. The overall level of support for non-bash shells is poor, but I made sure for myself that zsh is working :)

@ttuegel Ah, thx!

After upgrading to the pre-release version of 18.03, i've got a similar issue in bash, but with nix-repl instead of nix-env. Using export NIX_REMOTE=daemon helped... How can i fix this?

EDIT: Hmm, I had nix installed by default as root via nix-env. Removing it fixed that.

Experiencing the same, upgraded to 18.03 and nix-env doesn't work until I set NIX_REMOTE. Somehow the default profile didn't get a v2 nix

lrwxrwxrwx 1 root root 66 Jan 1 1970 /nix/var/nix/profiles/default/bin/nix-env -> /nix/store/hb61in5qxb0a0nfkf9hqa0449vg1lkc5-nix-1.11.8/bin/nix-env

Concerning nix-repl, it turned out it was enough to use nix repl instead (and uninstall nix-repl).

Was this page helpful?
0 / 5 - 0 ratings