nixpkgs-search #
Search nixpkgs from your terminal, using the same Elasticsearch backend that powers search.nixos.org. Results are piped through fzf for fuzzy selection with a live preview of package metadata.
Usage #
nixpkgs-search ripgrep
nixpkgs-search --channel 24.11 firefox
nixpkgs-search --json hello
nixpkgs-search --nixery python git curl
nixpkgs-search --nixery --loop python git curl
nixpkgs-search --no-fzf --n 20 vim
Flags:
--channel— nix channel to search (defaultunstable)--n— max results (default50)--json— dump raw hits and exit--nixery— select multiple packages and print a/-delimited package list for Nixery--loop,-l— with--nixery, run one picker per query instead of merging all results into one picker--no-fzf— force numeric picker even iffzfis available
On selection, the chosen attribute name is printed to stdout, so it composes:
nix shell nixpkgs#$(nixpkgs-search ripgrep)
When stdout or stderr is not attached to a TTY, nixpkgs-search skips the picker
and prints a newline-delimited list of matching package attribute names. This is
intended for shell completions and scripts:
nixpkgs-search --n 20 rip
With --nixery, each positional argument is searched independently, all results are merged into one multi-select picker, and the selected attributes are printed as a Nixery path:
docker run -it nixery.dev/$(nixpkgs-search --nixery python git curl)
Use --loop or -l to handle each query in its own picker and join the selections at the end.
Install / run with Nix #
Run without installing:
nix run git+https://git.sr.ht/~chiefnoah/nixpkgs-search -- ripgrep
Install into a profile:
nix profile install git+https://git.sr.ht/~chiefnoah/nixpkgs-search
Or add as a flake input and reference packages.<system>.default.
Development #
A dev shell with Go, gopls, staticcheck, fzf, and the built binary itself is provided:
nix develop
go build ./...
go run . ripgrep
If you use direnv, drop use flake into .envrc.
How it works #
main.go resolves the current latest-<N>-nixos-<channel> Elasticsearch alias, POSTs a query shaped like the one search.nixos.org sends, then renders each hit and hands them to fzf with a per-package preview file. Credentials are the same public ones the web frontend uses.