nix-search
Search for Nix packages
TLDR
Search nixpkgs for a package based on its name or description
Show description of a package from nixpkgs
Show all packages available from a flake on github
SYNOPSIS
nix-search [OPTIONS] <SEARCH_STRING>...
PARAMETERS
--all-channels
Search all channels available to the current user (e.g., from NIX_PATH).
--channel <CHANNEL>
Search for packages available in the specified Nix channel. This can be a URL or a name from NIX_PATH.
--description
Include package descriptions in the search scope, in addition to names.
--json
Output the search results in a structured JSON format, useful for scripting.
--limit <LIMIT>
Restrict the number of returned search results to the specified limit.
--offline
Perform the search using only local, cached package data, without contacting remotes.
--path <PATH>
Search for packages located within a specific Nix path or directory.
--remote <REMOTE>
Search packages from a designated remote repository or Nix store.
--revision <REVISION>
Search against a specific revision or commit of a channel's package set.
--system
Filter results to packages built for the current system architecture (e.g., x86_64-linux).
--max-derivations <MAX_DERIVATIONS>
Limit the number of derivations considered during the search process, impacting performance.
DESCRIPTION
The nix-search command is a powerful utility for finding software packages within the Nix ecosystem. It allows users to query the vast collection of Nix packages, identifying them by name, and optionally by their descriptions. This command is essential for discovering available software, understanding package names for installation, or finding dependencies for development environments.
It operates by searching the Nix path (NIX_PATH), which typically includes configured Nix channels or local package definitions. When not in offline mode, it can also query remote sources to retrieve the latest package information. The search mechanism typically uses regular expressions, making it highly flexible for precise or broad searches. The output provides a list of matching packages, often including their full Nix path, description, and the system they target.
CAVEATS
The command can be slow when searching very large or numerous remote channels without a strong network connection or sufficient local caching. It's important to note that the standalone nix-search command might be deprecated or superseded by the nix search subcommand within the modern nix unified CLI, which offers similar or enhanced functionality.
SEARCH STRING AND REGULAR EXPRESSIONS
The SEARCH_STRING argument is interpreted as a regular expression. This allows for flexible and powerful search queries, enabling users to match partial names, specific patterns, or even combine multiple criteria. For example, nix-search 'firefox|chromium' would find packages related to both browsers.
OUTPUT FORMAT
By default, nix-search provides human-readable output, listing package names, versions, and descriptions in a table-like format. The --json option is highly recommended for scripting or programmatic consumption, providing structured data that can be easily parsed and processed by other tools.
HISTORY
Historically, package searching in Nix was often performed using nix-env -qa. The dedicated nix-search command (or later, the nix search subcommand) was introduced to provide a more focused and efficient interface for package discovery. This evolution reflects the Nix project's move towards a more user-friendly and consolidated command-line experience, separating search functionality from environment management.