Weird nix search results


on NixOS 21.11 with Nix 2.3.16, when I nix search pip-tools, I get

* nixpkgs.python27Packages.pip-tools (python2.7-pip-tools)
  Keeps your pinned dependencies fresh

* nixpkgs.python37Packages.pip-tools (python3.7-pip-tools)
  Keeps your pinned dependencies fresh

However, I can get pip-tools for python3.9 with nix-shell -p python39Packages.pip-tools. shows me python38Packages.pip-tools and python39Packages.pip-tools. And actually installing pip-tools for python2.7 that was found by nix search does not work:

nix-shell -p python27Packages.pip-tools
error: pip-tools-6.3.1 not supported for interpreter python2.7

My NIX_PATH is nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels (which is what nix-shell reads, right?)

So it seems nix search is looking somewhere else for nixpkgs? But where?

I’m assuming you have more than one nixpkgs channel on your system. The python27 package set hasn’t been exposed in over a year.

If you run nix-shell -p nix-info --run "nix-info -m" you should see everything.

1 Like

I was suspecting something similar (especially since I was using Nix before switching to NixOS, and when switching to NixOS simply copied my complete home folder to the new machine), but running the command you provided doesn’t reveal anything suspicious to me:

~: nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.89, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.335037.e67c94a1adb"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I was first suspecting ~/.nix-defexpr, but I think that’s ok:

~: l ~/.nix-defexpr
total 0
lrwxrwxrwx 1 jan users 43 22. Dez 22:34 channels -> /nix/var/nix/profiles/per-user/jan/channels
lrwxrwxrwx 1 jan users 44  9. Jan 2019  channels_root -> /nix/var/nix/profiles/per-user/root/channels

~: l /nix/var/nix/profiles/per-user/jan
total 0

(so there is channels symlink, but it’s broken so I assume it shouldn’t pollute my search results)

Aah, it was just the nix search cache. I did get a warning about it using cached results but got somewhat used to that warning and ignored it. So nix search -u pip-tools gives the expected result :innocent: