Closed dakotaclemenceplaza closed 2 years ago
Are you talking about /nix/var/nix/profiles/default/bin
profile specifically? Note: it's not a currently selected profile, but rather a always-present profile for everyone. root
can install packages for every user to be visible that way.
Or you are seeing something else as well?
I don't think we patch init script in overlay package. Whatever sys-apps/nix
does should be an upstream behavior we observer.
Here are my PATH
s on NixOS:
$ echo $PATH |& tr ':' $'\n'
/run/wrappers/bin
/home/fresh/.nix-profile/bin
/etc/profiles/per-user/fresh/bin
/nix/var/nix/profiles/default/bin
/run/current-system/sw/bin
/nix/var/nix/profiles/default/bin
is certainly there.
Here are my PATH
s on Gentoo/nix:
$ echo $PATH | tr ':' $'\n'
/home/fresh/.nix-profile/bin
/home/fresh/.nix-profile/bin
/nix/var/nix/profiles/default/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/opt/bin
/usr/lib/llvm/14/bin
/usr/lib/llvm/13/bin
/nix/var/nix/profiles/default/bin
is also there.
I think that you won't get any other profiles into the PATH
. Note that /home/$HOME/.nix-profile/bin
is the first in the list. That defines your current user's profile.
Do you think it's an incorrect behavior?
My PATH
on Gentoo is just as yours regarding nix, nothing else. I don't know if it's incorrect really, duplication certainly would not bring any problems, I guess, but since I noticed it I went to see why is it duplicated, does nix-daemon.sh
really needs to set $HOME/.nix-profile/bin
if nix.sh
will set it anyway?
And regarding the other path, that's just what I read in the manual, so I thought that only $HOME/.nix-profile/bin
should be in PATH
of a user and nothing else and that maybe Gentoo installation changes something.
Oh, I somehow missed the PATH duplication entirely. Let's try to sort it first:
PATH
entry: https://github.com/NixOS/nix/issues/6685And then we'll try to improve documentation around various PATH
s.
Hm, having read through scripts/install-multi-user.sh
I think nix-daemon.sh
is ever intended for daemon itself, never for user. Removing it should fix both issue you have noticed.
Pushed the change as https://github.com/trofi/nix-guix-gentoo/commit/7da9ad51d6a9ce15048460839d966c2aba1cf64c
Should be available as nix-2.9.0-r1
. Please give it a try.
Seems to work as expected.
Woohoo! Thank you for the report and test!
Let's close it as fixed then.
Both files
nix-daemon.sh
andnix.sh
in/etc/profile.d
add$HOME/.nix-profile/bin
to PATH. Also, the official nix manual sayswhereas
nix-daemon.sh
adds this path.