Duplicate results in `nix search`

…I’m not at all sure what I’ve done, but I’m somehow seeing duplicate results whenever I run nix search. For each result, I see it under both nixpkgs. and nixos.:

$ nix search -u podman                                                        
* nixos.podman (podman)
  A program for managing pods, containers and container images

* nixpkgs.podman (podman)
  A program for managing pods, containers and container images

I believe I only have the nixos channel set up:

$ nix-channel --list                                                          
$ sudo -i nix-channel --list
nixos https://nixos.org/channels/nixos-unstable

…where else might nix search be looking?

nix search uses NIX_PATH to determine where to find packages.

$ nix search -u podman
* nixos.podman (podman)
  A program for managing pods, containers and container images

* nixpkgs.podman (podman)
  A program for managing pods, containers and container images

$ NIX_PATH= nix search -u podman
error: no results for the given search term(s)!

$ echo $NIX_PATH
/home/jon/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

$ NIX_PATH=/home/jon/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos nix search -u podman
* nixpkgs.podman (podman)
  A program for managing pods, containers and container images
1 Like

@jonringer I’m also experiencing the same issue but this solution doesn’t work for me.

I think it’s because I’m using nixpkgs as my user’s channel and nixos-unstable named nixos as root’s channel. This is the layout of the directories in question:

$ tree ~/.nix-defexpr /nix/var/nix/profiles/per-user ~/.nix-defexpr/channels/
/home/doron/.nix-defexpr
├── channels -> /nix/var/nix/profiles/per-user/doron/channels
└── channels_root -> /nix/var/nix/profiles/per-user/root/channels
/nix/var/nix/profiles/per-user
├── doron
│   ├── channels -> channels-38-link
│   ├── channels-38-link -> /nix/store/d3887hqg1lr5vanvdx13wi84xd8cxkh9-user-environment
│   ├── profile -> profile-587-link
│   ├── profile-586-link -> /nix/store/njhda5rxgizmbl9mba5ifmd2s1fgnz5s-user-environment
│   └── profile-587-link -> /nix/store/2spzklibyw0z1wl4dkag7lzwxbkn34vm-user-environment
├── lightdm
├── nixbld1
└── root
    ├── channels -> channels-69-link
    └── channels-69-link -> /nix/store/60vkpq8m97ncg27iwmldlir33ix44j7g-user-environment
/home/doron/.nix-defexpr/channels/
├── binary-caches -> /nix/store/n8q83dx47i6n562l9q23ppf2c92i0112-nixos-unstable-19.09pre186563.b5f5c97f7d6/binary-caches
├── manifest.nix -> /nix/store/85d2y68262anf8spigg1ms7g07cwn000-env-manifest.nix
├── nixos-unstable -> /nix/store/n8q83dx47i6n562l9q23ppf2c92i0112-nixos-unstable-19.09pre186563.b5f5c97f7d6/nixos-unstable
└── nixpkgs -> /nix/store/s83av4k1grhcc3zcv6520am4gjwy7841-nixpkgs-20.03pre203598.f97746ba272/nixpkgs

16 directories, 1 file

Do I have too many channels? Have I configured them right in the first place? I think I’m effectively using the unstable channel after all…

I’m not actually sure on what is good or bad channel hygiene. I mostly go off what is master/unstable and call it a day