Recently I've got following warning when running nixos-rebuild
. I can't remember change any configuration.
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
Despite it is just a warning, not a critical one, I still want to know how to fix it properly.
[wizzup@ ~]$ sudo nixos-rebuild switch
[sudo] password for wizzup:
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
building Nix...
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
building the system configuration...
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
setting up tmpfiles
"x86_64-linux"
Linux 4.14.39, NixOS, 18.09pre139319.1d9330d63a5 (Jellyfish)
yes
no
nix-env (Nix) 2.0.2
"nixos-18.09pre139319.1d9330d63a5"
""
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
Does this also happen if you use sudo -i
?
Hello,
Having the same problem for the past few days on nixos-unstable. I thought I forgot to do something as it is a new install.
I can confirm that the warning doesn't appear with sudo -i
not with sudo -i
~~~~
[wizzup@ ~]$ sudo -i
[sudo] password for wizzup:
[root@earth:~]# nixos-rebuild switch
building Nix...
building the system configuration...
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
setting up tmpfiles
[root@earth:~]# logout
[wizzup@ ~]$ sudo nixos-rebuild switch
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
building Nix...
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
building the system configuration...
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
setting up tmpfiles
[wizzup@ ~]$
~~~~
I expect the change is a consequence of #38351.
This appears to be caused by 8ab8d9cb74e75de46e647a5d77c137f7ef3ebd2b. We shouldn't have variable references in nix.nixPath
because they don't get expanded in all contexts. (Indeed it's not clear whether that's desirable at all.) Ping @grahamc.
I guess there's also a more general problem that even if the variable is expanded, a warning is printed if the user doesn't have any channels, e.g. a simple nix-build -A hello
gives me:
warning: Nix search path entry '/home/tmtynkky/.nix-defexpr/channels' does not exist, ignoring
Maybe we could:
"~/.nix-defexpr/channels"
to nix.nixPath
would work and fix the original reporter's problem.~/.nix-defexpr/channels
-> /var/empty
symlink when the user doesn't have any channels, to get rid of the warning I posted.I ran nix-channel --update
(even though I have no channels; I just use the main nixos channel under root). It created a symlink at ~/.nix-defexpr/channels
(pointing to /nix/var/nix/profile/per-user/$USER/channels
, where there is symlink to a blank manifest.nix
).
This was enough to stop the warning, and seems to be the "proper" setup for a user subscribed to no channels.
My system is several nixos releases old, so having to manually do something to adjust my home dir is fine, though it took me a while to think of trying that. Perhaps the warning message could suggest this fix if the missing NIX_PATH entry being ignored is ~/.nix-defexpr/channels?
@cumber
I also have no channels.
When I run nix-channel --update
as a user, I get:
unpacking channels...
created 0 symlinks in user environment
When I run it as root,I get:
unpacking channels...
warning: Nix search path entry '$HOME/.nix-defexpr/channels' does not exist, ignoring
The warning remains, also at the next rebuild.
@magnetophon I should probably have been clearer, I was referring to dezgeg's report that you get a warning printed even in contexts where the variable is expanded, e.g.:
warning: Nix search path entry '/home/cumber/.nix-defexpr/channels' does not exist, ignoring
The behaviour I'm seeing is that nix commands run as my own user (nix run
, nix-env
, etc) print a warning with my home folder spelled out in full, but running sudo nixos-rebuild
prints a warning with the text $HOME
in the path.
The cause of the former seems to be an "improper" state for no subscribed channels (nonexistent channels
symlink instead of a symlink to a folder with a blank manifest), and I found that can be resolved by the step I mentioned. I still get the $HOME
warnings on nixos-rebuild
, but not warnings on every nix command now.
mkdir -p ~/.nix-defexpr/channels
workaround to silence the annoying message on every command
@jb55 That works, but I went with letting nix-channel --update
to avoid potential problems down the road. It seems nix wants the user channels folder to be a symlink to stuff it manages under /nix/var/nix/
(or equivalent on non-Nixos setups). If I later do want a user-level channel subscription, the nix command to set that up is probably expecting to do some work under /nix/var/nix/
and then overwrite a symlink, which could fail if the symlink is actually a real folder.
I've got these warnings after upgrading NixOS to 18.09.
I've got this on unstable as well : 19.03pre151837.ca2ba44cab4 (Koi)
Neither
mkdir -p ~/.nix-defexpr/channels
nor
ln -s /var/empty ~/.nix-defexpr/channels
silences it.
Fix applied in ee582a32d25d425ea76afcd9819cc788d17de5f2.
Seems fixed now on 18.09 and master. _And 18.03 shouldn't suffer from this IIRC._
Got this warning on fresh NixOS 19.03 install, without any configs touched. @cumber 's comment (i.e., nix-channel --update
) solved it.
Most helpful comment
Fix applied in ee582a32d25d425ea76afcd9819cc788d17de5f2.