How to Clear Up Warning: Nix Search Path Does Not Exist

Hey there, my administrator just installed Nix using the multi-user install script, but because root doesn’t have its proxy credentials setup properly the package update didn’t succeed even though the rest of the install went fine. After the install I’m able to use Nix fine from my user account ( not root ), because I have proxy credentials setup, I just had to add a channel ( nix-channel --add https://nixos.org/channels/nixpkgs-unstable ) first.

Now, though, every time I run a command I get:

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

Is there a way to silence that warning, preferably without requiring root access to make the changes? I’m not the admin on this machine, so it would be easier if I didn’t have to get the admin to clean this up, but if I do, that’s fine, I just need to know what to do for it.

Thanks!

Ah, I found it!

I just needed to remove the reference to the missing root package repo ( or whatever you call it exactly in Nix :wink: ) by overriding the NIX_PATH environment variable in my ~/.profile:

export NIX_PATH="nixpkgs=/home/zicklag/.nix-defexpr/channels/nixpkgs"

Also a good environment var to add that makes desktop app installation seamless:

export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share"

Edit: Ah, I also found that it is better to leave your default nix repo without the nixpkgs= in the NIX_PATH environment variable, otherwise you will have to nix-env -iA nixpkgs.hello instead of just nix-env -iA hello:

export NIX_PATH="/home/zicklag/.nix-defexpr/channels/nixpkgs"

Edit2: But now for some reason nix search can’t find any packages. :thinking: It seems like there isn’t a way to both have it un-prefixed and to have it pop up in nix search

I have nixpkgs aliased to nix-env -f '<nixpkgs>' so I can nixpkgs -iA hello

1 Like