Nix Index builds a database of files in nixpkgs derivations so you can find which package provides a path. It includes nix-locate for queries and optional shell integration when a command is missing.
Overview
Nix Index is a tool for quickly finding which nixpkgs package supplies a given file. It indexes built derivations discovered in binary caches, producing a local database you generate before searching.
After the index is built, nix-locate matches file path patterns against that database. The workflow is geared toward Nix users who know a filename or path on disk but not the owning package attribute.
A separate nix-index-database project offers pre-generated databases and NixOS or home-manager modules if you prefer not to build the index locally. Index creation typically takes on the order of several minutes.
Nix Index can also act as a command-not-found helper in bash, zsh, fish, or Nushell, printing the nixpkgs attribute path when the shell cannot find an executable. Home-manager and NixOS configuration snippets wire this behavior into your environment.
Key features
- Indexes nixpkgs files from binary caches
- nix-locate pattern search against local database
- Optional pre-built databases via nix-index-database
- command-not-found shell integration
- Home-manager and NixOS module hooks
- Fish, bash, zsh, and Nushell support
Use cases
- Finding which package owns a file in nixpkgs
- Suggesting nix packages when a shell command is missing
- Avoiding local index builds with shared databases
- Day-to-day Nix package discovery on the command line