aboutsummaryrefslogtreecommitdiff

Offline-first nixpkgs lookup tools

This repository contains tools dedicated to search for Nix derivations and NixOS modules in your local nixpkgs channel. Think of it as an offline alternative to https://search.nixos.org.

Building

Building the packages requires at least Go 1.20

$ go build ./cmd/nix-search
$ go build ./cmd/nixos-search

nix-search searches for Nix derivations in your local nixpkgs repository. The package list is compiled using nix-env, and cached in ~/cache/nix_search.gz.

Creating the cache is done with the command:

$ nix-search -index

The cache file stores the version of nixpkgs. nix-search will warn you if the cache needs rebuilding (for example following a channel update).

Searching for derivations can be done like this:

$ nix-search firefox

Subderivations can be searched using the -category argument.

$ nix-search -category python311Packages requests

nixos-search searches for NixOS options. Each run will automatically build the NixOS documentation's options.json file, and search for options in it.

Example usage:

$ nixos-search bluetooth