Linux command
nix3-build 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Build the default package of a flake
nix build
Build a specific output of the current flake
nix build .#[package]
Build from nixpkgs
nix build nixpkgs#[hello]
Build without creating a result symlink
nix build --no-link
Build and print full build logs
nix build -L [installable]
Build and print output store paths
nix build --print-out-paths [installable]
Dry-run
nix build --dry-run [installable]
说明
nix build (invoked as nix3-build in this manual namespace to distinguish it from the legacy nix-build) builds the specified installables, which may be flake references, attribute paths, or store paths. On success it creates a symlink named _result_ (or _result-N_ for additional outputs) pointing to the build output in the Nix store. When multiple installables are given, each is built in parallel subject to the configured build concurrency.
参数
- --no-link
- Do not create a result symlink.
- -o _PATH_, --out-link _PATH_
- Use _PATH_ as the prefix for the result symlink (default: _result_).
- --rebuild
- Rebuild an already-built derivation and compare outputs.
- --print-out-paths
- Print the resulting store paths to stdout.
- -L, --print-build-logs
- Show full build logs on standard error.
- --json
- Print build results as JSON.
- --dry-run
- Show what would be built or fetched without actually doing it.
- --impure
- Allow evaluation of impure expressions (e.g. references to environment variables).
- --refresh
- Consider all previously downloaded files as stale.
- --help
- Display help information.
FAQ
What is the nix3-build command used for?
nix build (invoked as nix3-build in this manual namespace to distinguish it from the legacy nix-build) builds the specified installables, which may be flake references, attribute paths, or store paths. On success it creates a symlink named _result_ (or _result-N_ for additional outputs) pointing to the build output in the Nix store. When multiple installables are given, each is built in parallel subject to the configured build concurrency.
How do I run a basic nix3-build example?
Run `nix build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --no-link do in nix3-build?
Do not create a result symlink.