Linux command
nix-build.3 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Build the default expression in the current directory
nix-build
Build a specific Nix expression
nix-build [file.nix]
Build a named attribute from a file
nix-build [file.nix] -A [attribute]
Pass a typed argument to the expression
nix-build --arg [name] [value]
Pass a string argument to the expression
nix-build --argstr [name] "[string]"
Continue building other derivations on failure
nix-build --keep-going
Show what would be built without building
nix-build --dry-run
Build without creating a result symlink
nix-build --no-out-link
说明
nix-build is one of the classic Nix CLI tools. It evaluates a Nix expression into one or more derivations, realises them (building or substituting their outputs), and creates a symlink named result in the current directory pointing at the output path. If multiple outputs are produced, symlinks are named result, result-2, and so on. This manpage variant documents the same binary as nix-build(1), shipped under an alternate section in some distributions.
参数
- -A _attr_, --attr _attr_
- Select an attribute from the top-level expression (dotted paths supported).
- --arg _NAME_ _VALUE_
- Pass VALUE (a Nix expression) as the argument NAME.
- --argstr _NAME_ _VALUE_
- Pass VALUE as a string argument NAME.
- --keep-going, -k
- Keep building dependencies even after a failure.
- --dry-run
- Show which derivations would be built or substituted without building them.
- --no-out-link
- Do not create a result symlink to the output.
- -o _name_, --out-link _name_
- Change the name of the result symlink (default: result).
- -j _n_, --max-jobs _n_
- Number of derivations to build in parallel.
- --option _NAME_ _VALUE_
- Set an arbitrary Nix configuration option.
FAQ
What is the nix-build.3 command used for?
nix-build is one of the classic Nix CLI tools. It evaluates a Nix expression into one or more derivations, realises them (building or substituting their outputs), and creates a symlink named result in the current directory pointing at the output path. If multiple outputs are produced, symlinks are named result, result-2, and so on. This manpage variant documents the same binary as nix-build(1), shipped under an alternate section in some distributions.
How do I run a basic nix-build.3 example?
Run `nix-build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -A _attr_, --attr _attr_ do in nix-build.3?
Select an attribute from the top-level expression (dotted paths supported).