Multiuser installer failed to create .nix-profile

OS: Ubuntu 20.04
I followed the Nix 2.3.10 manual for Multi User Installation (4.2). Specifically:

sh <(curl -L --daemon

Installing succeeded:

I am executing:

$ sudo systemctl restart nix-daemon.service

to start the nix-daemon.service

Alright! We’re done!

After opening a new shell, .nix-profile is not in user’s home and no nix-* commands found. E.g., ‘nix-shell’ gives ‘command not found’

Contents of /etc/profile.d/

# Nix
if [ -e ‘/nix/var/nix/profiles/default/etc/profile.d/’ ]; then
. ‘/nix/var/nix/profiles/default/etc/profile.d/’
# End Nix

How can I fix this machine’s config?

Might be that you just need to log-out and log-in again. (So that /etc/profile.d/ will get loaded)

1 Like

I am having precisely the issue reported by the OP, but on Debian(buster).

After running the install script, and after logging out and back in, ~/.nix-profile does not exist.

The indicated script /etc/profile.d/ seems to set environment variables, but not actually make the indicated symlink
~/.nix-profile → /nix/var/nix/profiles/…

I’m a complete nix newbie, and so it is not at all clear to me what ought to happen, precisely.

Any advice appreciated!

I think it is created when you run certain nix commands. I just deleted mine and then ran nix-env -q and it automatically reappeared.

hi – thanks for that! Indeed the symlink was created upon running

nix-env -q

as you suggested. Not precisely sure why I hadn’t tried that – probably mostly “bad luck”. I seem to have jumped the gun when I didn’t see the symlink – I had tried manually creating the symlink ~/.nix-profiles, but didn’t do get it quite right (it appears that I had linked to /nix/var/nix/profiles/per-user/george and somehow left off the final .../profile) and was getting some odd-looking errors.