What is the best way to search for packages in the command line?

Title is my question. What is the best way to search for nix packages from the command line? Asking from both a NixOS and a nix-darwin standpoint.

Right now what I do is head to search.nixos.org to search for packages, but that’s not ideal since I have to leave my terminal. I have tried nix search nixpkgs somePackage but that takes many minutes (last test I had run was nix search nixpkgs neofetch on my nix-darwin machine and that took 3:45).


It takes around 10 seconds on my machine, but it is so because i pinned the nixpkgs entry in the flake registry to the one currently in use.

$ time nix search nixpkgs neofetch
* legacyPackages.x86_64-linux.freshfetch (0.2.0)
  A fresh take on neofetch

* legacyPackages.x86_64-linux.neofetch (2020-11-26)
  A fast, highly customizable system info script

real	0m10,138s
user	0m7,766s
sys	0m1,011s

By default it points to the bare nixpkgs repo (master branch) and so nix downloads a new version of it most of the times.


I wonder if that should be documented on the wiki entry about flakes. It’s very useful for other nix commands, too.

This worked well. Thanks!

If you’re ever wondering which package has e.g. which binary, I can also recommend nix-index:

λ ma27 [~] → nix-locate bin/alacritty
alacritty.out                                 6,751,040 x /nix/store/banp6bmjz72q2j5r6i61cc22pgjpq3ks-alacritty-0.8.0/bin/alacritty

(Doesn’t meant to be an alternative, but a nice addition for the problem statement I described above).


I hate to hijack my own thread: is there a way to search options for configuration from your system as well? That’s another thing I have to head to the internet for, and that’s even worse since sometimes I can head to NixOS Search - Loading..., but other times I have to go to Appendix A. Configuration Options for home-manager stuff

1 Like

I use “man configuration.nix” and / in there


There is also man home-configuration.nix for the latter.