nix icon indicating copy to clipboard operation
nix copied to clipboard

Nix installation/reinstallation fails to setup `.nix-profile` symlink

Open halhenke opened this issue 2 years ago • 4 comments

Describe the bug

Nix install never creates a profile symlink to ~/.nix-profile. My per-user profile directory (/nix/var/nix/profiles/per-user/hal/) is also empty at the end of installation.

Steps To Reproduce

run

❯ sh <(curl -L https://nixos.org/nix/install)

Expected behavior

A clear and concise description of what you expected to happen.

To have a directory ~/.nix-profile/ in which to install packages etc

Additional context

Am on macOS 12.2.1.

Tried to reinstall over the top of previous installation after I couldnt upgrade from 2.6. After various installation failures manually removed the nix Volume - now installation script runs to completion but I have no profile and not really sure what to symlink to in order to manually get out of this situation.

halhenke avatar Mar 17 '22 07:03 halhenke

Maybe there’s some MacOS specific thing that I don’t know about, but Nix should lazily create it the first time you run nix-env. Is that also not the case?

thufschmitt avatar Mar 17 '22 13:03 thufschmitt

#3136

abathur avatar Mar 17 '22 15:03 abathur

Maybe there’s some MacOS specific thing that I don’t know about, but Nix should lazily create it the first time you run nix-env. Is that also not the case?

I just prepended /nix/var/nix/profiles/default/bin to my PATH (the only place i have found a nix-env etc) and after running nix-shell -p nix-info --run "nix-info -m" it does indeed create the ~/.nix-profile symlink. However it symlinks to /nix/var/nix/profiles/per-user/hal/profile which is a directory that doesnt exist after this installation. Running nix-env doesnt seem to do anything else that i can see.

halhenke avatar Mar 17 '22 19:03 halhenke

I just prepended /nix/var/nix/profiles/default/bin to my PATH (the only place i have found a nix-env etc)

This should already be on your PATH in a multi-user install: https://github.com/NixOS/nix/blob/6afc3617982e872fac2142c3aeccd1e8482e7e52/scripts/nix-profile-daemon.sh.in#L37

I'd look into whether your profile/rc scripts are misconfigured or aborting early.

and after running nix-shell -p nix-info --run "nix-info -m" it does indeed create the ~/.nix-profile symlink. However it symlinks to /nix/var/nix/profiles/per-user/hal/profile which is a directory that doesnt exist after this installation. Running nix-env doesnt seem to do anything else that i can see.

Why are you expecting anything to be in this directory? What are you expecting to be there?

abathur avatar Mar 17 '22 22:03 abathur