LinuxCommandLibrary

nix3-search

Search Nix packages by name and description

TLDR

Search nixpkgs for a package based on its name or description

$ nix search [nixpkgs] [search_term]
copy

Show description of a package from nixpkgs
$ nix search [nixpkgs#pkg]
copy

Show all packages available from a flake on github
$ nix search [github:owner/repo]
copy

SYNOPSIS

nix search [<flake-url>] [options] <query>...

PARAMETERS

<flake-url>
    An optional flake URL (e.g., github:NixOS/nixpkgs#hello, path:/my/flake) to specify where to search. If omitted, it defaults to the primary nixpkgs instance in the current flake's inputs or the global registry.

<query>...
    One or more search terms to match against package names, descriptions, or attribute paths. Multiple terms will narrow the search.

--json
    Output search results in a machine-readable JSON format, suitable for scripting and programmatic parsing.

--offline
    Operate without attempting to connect to the internet, useful for reproducible builds or when network access is unavailable.

--refresh
    Force a refresh of the flake registry and all flake inputs before performing the search, ensuring the latest package metadata is used.

--inputs-from <flake-url>
    Perform the search using the flake inputs defined in a different flake, without changing the current directory's flake context.

--override-input <name> <path|flake-url>
    Temporarily override a specific flake input named <name> with a local path or another flake URL for the duration of the search.

--system <system>
    Search for packages compatible with a specific system architecture (e.g., x86_64-linux, aarch64-darwin) instead of the current system.

--legacy
    Perform the search using the legacy NIX_PATH mechanism instead of the default flake-based evaluation. Useful for non-flake environments.

DESCRIPTION

nix search is a powerful command in the Nix ecosystem, designed to help users discover and locate packages, derivations, and attributes available within the Nix store or defined in Nix flakes. It queries package registries, local flake inputs, or specified flake URLs to find items matching one or more provided string patterns.

This command is crucial for exploring the vast collection of software managed by Nix, allowing users to search by package name, description, or other metadata. The output typically presents the package's attribute path, version, and a concise description, making it easy to identify the desired software. nix search seamlessly integrates with the Nix flake system, enabling searches across various Nix channels, specific flake inputs, or arbitrary local/remote flake URLs. It serves as the primary tool for users to efficiently navigate and leverage the Nix package collection.

CAVEATS

The initial execution of nix search or runs with --refresh can be slow as it might involve fetching significant package metadata from the internet.

The command searches against *available* derivations in the configured repositories or flakes, not necessarily packages currently *installed* on your system.

The textual output can be verbose; using the --json option is highly recommended for scripting or integration with other tools.

HISTORY

The nix search command is a core component of the "new" Nix command-line interface (CLI), which was introduced as an experimental feature (nix-command) and became the default CLI in Nix versions 2.4/2.6 onwards. Prior to this, users often relied on commands like nix-env -qa or manual browsing of the NixOS package website for package discovery. The unified nix search command provides a more intuitive, powerful, and flake-aware mechanism for searching Nix packages and attributes directly from the terminal, integrating seamlessly with the modern Nix ecosystem.

SEE ALSO

nix build(1), nix run(1), nix shell(1), nix flake(1), grep(1)

Copied to clipboard