NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.45k stars 1.44k forks source link

Nix path doesn't add itself in zshrc #10945

Open gyanaranjans opened 1 week ago

gyanaranjans commented 1 week ago

Platform

Additional information

Nix is not in the path after i install nix even though /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh file exists

also Nix configuration is correctly added to the shell initialization files

cat /etc/zshrc /etc/bashrc /etc/bash.bashrc | grep nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'

output

Priorities

Add :+1: to issues you find important.

abathur commented 1 week ago

Nix not being on PATH generally points to your shell init files either hard-setting a PATH that doesn't include Nix after Nix's shell hook ran (often from one of the user-specific init files in ~/), or perhaps having an early return condition in the relevant init file that is keeping the shell hook from running at all.

If env | grep NIX shows a few variables, that's a good sign the shell hook is at least running and you can focus on looking for what might be overwriting PATH.