This other issue is already marked as solved, so I thought I’d open a new one.
As detailed in the comment at Duplicate results in `nix search` - #5 by trusktr, I made my first NixOS install and ran into the problem, and I’m not sure if the commands I listed are what caused it.
But now I have completed a brand new second install just to be sure I am doing it right, and this time I’m following the manual exactly so to avoid any possibility that I deviated and caused the issue.
Now, after installing Nix onto my chosen disk, I am still having the issue.
Once I logged into the new Nix OS, I ran the following as root, which shows duplicate packages:
[trusktr@starnix:~]$ nix search tweak-tool
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: no results for the given search term(s)!
[trusktr@starnix:~]$ sudo bash
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for trusktr:
[root@starnix:/home/trusktr]# nix-channel --list
nixos https://nixos.org/channels/nixos-19.09
[root@starnix:/home/trusktr]# nix search tweak-tool
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: no results for the given search term(s)!
[root@starnix:/home/trusktr]# nix-channel --update
unpacking channels...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
created 1 symlinks in user environment
[root@starnix:/home/trusktr]# nix-channel --update
unpacking channels...
[root@starnix:/home/trusktr]# nix search tweak-tool
warning: using cached results; pass '-u' to update the cache
error: no results for the given search term(s)!
[root@starnix:/home/trusktr]# nix search -u tweak-tool
* nixos.gnome3.gnome-tweak-tool (gnome-tweaks-3.32.0)
A tool to customize advanced GNOME 3 options
* nixpkgs.gnome3.gnome-tweak-tool (gnome-tweaks-3.32.0)
A tool to customize advanced GNOME 3 options
[root@starnix:/home/trusktr]# nix search tweak-tool
warning: using cached results; pass '-u' to update the cache
* nixos.gnome3.gnome-tweak-tool (gnome-tweaks-3.32.0)
A tool to customize advanced GNOME 3 options
* nixpkgs.gnome3.gnome-tweak-tool (gnome-tweaks-3.32.0)
A tool to customize advanced GNOME 3 options
[root@starnix:/home/trusktr]# nix-channel --list
nixos https://nixos.org/channels/nixos-19.09
Why do I have duplicate results from both nixos and nixpkgs although nix-channel --list shows only one channel? I’m completely new to NixOS, so I have no clue why there are duplicate results.
When I was following the steps in 2.5.4. Installing from another Linux distribution, the search results from my Ubuntu instance did not have duplicates. I only see duplicates when I search from inside my new Nix install.
It looks just about the same, except for his user-specific prefix. Are duplicate results simply expected? I am thinking that I did something wrong, and that having duplicate results is something that a more advanced user would have if they enable multiple channels, which as a new user was not trying to do.
it will show “duplicates” because it’s picking up more than one channel. It could be that your nixos channel is stable, and your nixpkgs channel is unstable. In which you could get packages of different version from them.
When I followed the steps in 2.5.4, after I booted into my new Gnome desktop, I logged in as root, created a password for my normal user, then while logged in as root I ran the commands I posted above, which showed the duplicate results. Basically I haven’t done anything on this new system other than that.
I’m totally new to Nix. I followed the steps in 2.5.4. Installing from another Linux distribution, and when I boot into the brand new Nix install that’s what nix search shows (the results from two channels).
$ tree ~/.nix-defexpr
/home/gmaudoux/.nix-defexpr
└── channels_root -> /nix/var/nix/profiles/per-user/root/channels
I guess yours could have two entries. I have no idea what this does, except that it is precisely linked to the behavior of these top-level nixos and nixpkgs attributes in some cases.
If you have two entries, it should be safe to keep only the channels_root to fall back to a “proper” nixos distribution setup.