"nix search" duplicate results in brand-new NixOS install. How to fix?

I found the source of the discrepancy. I was using nixUnstable, in a version that did not yet receive a patch that has been cherry-picked to nix 2.3.

The behavior of supporting channels, and hence finding the nixos channel was introduced in 1d5cb6ad4839a50a96c27c94f19adcb97b6391af:

commit 1d5cb6ad4839a50a96c27c94f19adcb97b6391af
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Wed Oct 9 15:36:51 2019 +0200

    getSourceExpr(): Handle channels
    
    Fixes #1892.
    Fixes #1865.
    Fixes #3119.
    
    (cherry picked from commit e6e61f0a54dac0174df996e93fcfedcac7769ab4)

Mark the linked comment from Eelco:

No, it’s not a bug. Rather, the nix command does not have a replacement for channels yet, so it’s currently left undefined where it gets its inputs from. (This is one of the main reasons why the nix CLI is marked experimental.) So currently it only uses prefixed NIX_PATH elements like nixpkgs=... .

I guess at some point Eelco changed his mind due to the number of bugs filed, and added support for channels in there. Benefit is that nix now sees them, the downside is that some entries may appear twice.
You can try to report this bug, but where, and to whom I am not sure.
Not sure if there is a proper fix in the meantime either.

Basically, this falls in the “nix command is still experimental” kind of WONTFIX (yet) issues.

1 Like