nix-* not in PATH after install

Created on 13 Jan 2020  路  7Comments  路  Source: NixOS/nix

Hi,

I installed Nix like this:

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

At the end it says,

Try it! Open a new terminal, and type:

  $ nix-shell -p nix-info --run "nix-info -m"

So I try that (yes, in a new terminal):

~ >>> nix-shell -p nix-info --run "nix-info -m"                                
zsh: command not found: nix-shell

Here's my $PATH:

~ >>> echo $PATH                                                          [127]
/home/chad/.zplugin/polaris/bin:/home/chad/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

(I'm apparently doing Perl stuff? Weird.)

Any ideas?

I'm running Manjaro Linux 5.4.6 on a Dell XPS 9560. Shell is zsh.

installer

Most helpful comment

In my case using Ubuntu and zsh had to set the PATH myself.
export PATH="$PATH:/nix/var/nix/profiles/default/bin"

and this path didn't exist at all:
HOME/.nix-profile/etc/profile.d/nix.sh

All 7 comments

Maybe the profile is not getting sourced? Does source $HOME/.profile work?

Thanks @matthewbauer , yes that was it. I don't really understand the role of .profile. I don't think zsh ever touches it, seems an odd place to put things for general use. But maybe I'm misunderstanding

Yeah this does look like a bug. At least zprofile should be installed by install-nix-from-closure.sh here:

https://github.com/NixOS/nix/blob/8b09105db3869284ee7892f82155dda79f98d6e6/scripts/install-nix-from-closure.sh#L147

According to this, only .zprofile or .zshrc is read at login time:

https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/

and we should probably make Bash & Zsh equivalent. Also, I think the instructions are wrong. Depending on how your OS is configured, you may have to log back out and then back in for these new settings to take effect.

/cc @grahamc

I tried the installer on my debian buster using the fish shell. The nix daemon started okay, but after logging out and in, the nix-shell is not found. I only found it via
`sudo find / -name nix-shell
/nix/store/4vz8sh9ngx34ivi0bw5hlycxdhvy5hvz-nix-2.3.7/bin/nix-shell

I fixed this problem by creating ~/.config/fish/config.fish with the line
set PATH /nix/var/nix/profiles/default/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin

I have the same problem, Ubuntu 20.04, Installed but the installer did not modified my .profile at all. This happened when I installed using sh <(curl https://nixos.org/nix/install) --daemon Installing this way: curl -L https://nixos.org/nix/install | sh did modify my .profile and everything is working well.

Same thing here on Manjaro. Nix does not get added to path (tried .bashrc, .bash_profile, .profile too)

In my case using Ubuntu and zsh had to set the PATH myself.
export PATH="$PATH:/nix/var/nix/profiles/default/bin"

and this path didn't exist at all:
HOME/.nix-profile/etc/profile.d/nix.sh

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luc65r picture luc65r  路  3Comments

eqyiel picture eqyiel  路  3Comments

bennofs picture bennofs  路  3Comments

bryanhuntesl picture bryanhuntesl  路  3Comments

ericsagnes picture ericsagnes  路  3Comments