← 返回命令列表

Linux command

nix-search 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Search Nixpkgs for a package

nix search nixpkgs [query]

Search with JSON output

nix search nixpkgs [query] --json

Search a specific flake

nix search [github:owner/repo] [query]

Search and exclude matching packages

nix search nixpkgs [query] --exclude [regex]

Search with multiple terms (AND logic)

nix search nixpkgs [python] [http]

说明

nix search searches for packages in Nix flakes by matching against package names, attribute paths, and descriptions. Multiple search terms are ANDed together. Part of the experimental new Nix CLI (requires `nix-command` and `flakes` experimental features enabled).

参数

--json
Output results in JSON format.
-e, --exclude _regex_
Exclude packages whose attribute path, name, or description match the regex.
--impure
Allow access to mutable paths and external repositories.
-I, --include _path_
Add a path to the Nix search path for resolving lookup paths.
--offline
Operate without network access.
--refresh
Force a refresh of the flake registry and inputs before searching.

FAQ

What is the nix-search command used for?

nix search searches for packages in Nix flakes by matching against package names, attribute paths, and descriptions. Multiple search terms are ANDed together. Part of the experimental new Nix CLI (requires `nix-command` and `flakes` experimental features enabled).

How do I run a basic nix-search example?

Run `nix search nixpkgs [query]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --json do in nix-search?

Output results in JSON format.