Introducing nix-search, a CLI for search.nixos.org

Hello everyone, I would like to introduce you to nix-search, a CLI tool that you can use instead of the serach.nixos.org website. I am looking for feedback and suggestions, particularly on the user experience. (I know the internals are not very good right now.)

You can try it today as a flake:

nix shell github:peterldowns/nix-search-cli

By default, any queries you pass will work exactly the same way as they would on the website:

nix-search python

You can also do some more powerful tricks, like filter by the names of installed binaries, or by version. So to find which attribute you’d want to install in order to get python3 running at version 3.12, you can search:

nix-search --program python --version 3.12

By default, the results are compact and colorized. If your terminal supports it, each result will be a link to the website. You can also emit the results as JSON, or show more details.

I hope you find this useful. I am looking for any suggestions, comments, or feedback. Thank you.

13 Likes

To clarify, this is making network requests to search.nixos.org when run, correct? It’s not getting the data from your local nixpkgs?

4 Likes

Correct, this is querying the community-maintained elasticsearch indexes in the exact same way that the search.nixos.org website does, and it requires an internet connection in order to do so. For an offline / local search, I think the current best option is nix-index / nix-locate.

4 Likes