Why doesn't search.nixos.org also search binary names

Why is it that this search for qemu-img turns up completely empty? The qemu-img binary is included in a few different packages including qemu, etc.

Is there any way we could get search.nixos.org to search binary names, not just the package name?


I know it’s not what you asked, but you know about the local hook, right?

$ qemu-img
The program 'qemu-img' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
  nix-shell -p kvm
  nix-shell -p qemu
  nix-shell -p qemu-utils
  nix-shell -p qemu_full
  nix-shell -p qemu_test
  nix-shell -p qemu_xen
  nix-shell -p qemu_xen-light

(You can also explicitly invoke it by command-not-found qemu-img.)

1 Like

What you are asking for is nix-index & nix-locate.

I 100% believe the NixOS community should adopt these tools and incorporate them into the web search portal.


search.nixos.org is effectively just a frontend to an elastic search instance. We fill the elastic index using an indexer that evaluates (i.e not builds) nixpkgs parses the result and pushes it to elastic. This all is done in a GitHub action for several versions of nixpkgs as well as a list of public flakes.
As we do not build any derivation there is no way to tell the outputs given just the nix definition.
It would be great if we could include a tool like nix-index yet given the different index structures and the fact that we have to push it to elastic at some point, we could only use parts of nix index up to where it queries hydra at best.
Luckily nix-index is written in rust as is the search backend. some sort of low level integration might therefore be possible in the long run.

1 Like

Hello, I created a new CLI tool that addresses exactly this problem. nix-search will query the elasticsearch indexes behind the search.nixos.org website exactly the same way that the web frontend does. It also allows additional, more powerful filters like "installs a binary called foo". Until the website frontend is updated, you are welcome to give it a try. GitHub - peterldowns/nix-search-cli: CLI for searching packages on search.nixos.org