Nix: Nix programs keep saying `warning: Nix search path entry ...`

Created on 10 Jul 2019  Â·  6Comments  Â·  Source: NixOS/nix

Issue description

I installed Nix — multi-user, I think. _(I don't exactly understand what it means.)_ I am logged in as non-root user, but the Nix programs I use, specifically nix-channel, nix-env, nix-shell, keep saying this:

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

— Every time, sometimes several times in a row.

If I create this directory, and also nixpkgs in it, another problem appears:

error: opening file '/nix/var/nix/profiles/per-user/root/channels/nixpkgs/default.nix': No such file or directory

If I create this file, it still doesn't work:

error: syntax error, unexpected $end, at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/default.nix:1:1

I don't understand what reason is there for these programs to even try access something that belongs to another user.

Steps to reproduce

I installed Nix on Arch Linux from AUR, and then ran archlinux-nix because otherwise it doesn't work.

% sudo aura -A nix  # Aura is an AUR helper. It just installs packages from AUR, nothing more.
% sudo archlinux-nix setup-build-group
% sudo archlinux-nix install-sandbox
% sudo archlinux-nix enable-nix-daemon

Now, anything I do, I receive this warning.

Technical details

% nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-linux"`
 - host os: `Linux 5.1.16-arch1-1-ARCH, Arch Linux, noversion`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.2.2`
 - channels(kindaro): `"nixpkgs-19.09pre184803.d567c486ca5"`
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - nixpkgs: `/home/kindaro/.nix-defexpr/channels/nixpkgs`

Most helpful comment

It looks like the archlinux-nix installer is not setting up channels correctly. To add the root channel , you should do:

sudo -i nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
sudo -i nix-channel --update nixpkgs

All 6 comments

I'm experiencing the same problem on a single user installation on macOS.

$ nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.6.0, macOS 10.14.5`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.2.2`
 - channels(dirn): `"darwin, nixpkgs-19.09pre186574.88d9f776091"`
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - nixpkgs: `/Users/dirn/.nix-defexpr/channels/nixpkgs`

I see that the path is included in my $NIX_PATH, but I'm not sure how it got there.

$ echo $NIX_PATH
darwin-config=/Users/dirn/.nixpkgs/darwin-configuration.nix /nix/var/nix/profiles/per-user/root/channels /Users/dirn/.nix-defexpr/channels

It looks like the archlinux-nix installer is not setting up channels correctly. To add the root channel , you should do:

sudo -i nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
sudo -i nix-channel --update nixpkgs

I'm experiencing the same problem on a single user installation on macOS.

$ nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.6.0, macOS 10.14.5`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.2.2`
 - channels(dirn): `"darwin, nixpkgs-19.09pre186574.88d9f776091"`
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - nixpkgs: `/Users/dirn/.nix-defexpr/channels/nixpkgs`

I see that the path is included in my $NIX_PATH, but I'm not sure how it got there.

$ echo $NIX_PATH
darwin-config=/Users/dirn/.nixpkgs/darwin-configuration.nix /nix/var/nix/profiles/per-user/root/channels /Users/dirn/.nix-defexpr/channels

I think you should report this in nix-darwin issue tracker. I think the profile should not be setting up a root channel here:

https://github.com/LnL7/nix-darwin/blob/master/pkgs/darwin-installer/default.nix#L9

/cc @grahamc @LnL7

@matthewbauer This seems to work. Thank you.

I'm experiencing the same problem on a single user installation on macOS.
...
I see that the path is included in my $NIX_PATH, but I'm not sure how it got there.

Yes, same here. I’m not sure what triggered this inclusion either.

I tried a workaround of creating the relevant paths:

sudo mkdir -p /nix/var/nix/profiles/per-user/root/channels

But that only reduces some warnings. If creating the channels/nixpkgs path then it requires a default.nix file to exist.

It seems the workaround is to specifically re-export NIX_PATH in your ~/.profile

export NIX_PATH=$HOME/.nix-defexpr/channels

Otherwise, the following warnings get very noisy.

ldeck@ldeck ~ % nix-shell -p nix-info --run "nix-info -m"               
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"x86_64-darwin"`
 - host os: `Darwin 19.2.0, macOS 10.15.2`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.1`
 - channels(ldeck): `"nixpkgs-20.03pre204216.cc6cf0a96a6"`
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - nixpkgs: `/Users/ldeck/.nix-defexpr/channels/nixpkgs`

Is there any update on this? I'm seeing the same thing:

https://github.com/NixOS/nixpkgs/issues/78714

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dasJ picture dasJ  Â·  3Comments

ihsanturk picture ihsanturk  Â·  3Comments

luc65r picture luc65r  Â·  3Comments

daraul picture daraul  Â·  3Comments

vaibhavsagar picture vaibhavsagar  Â·  3Comments