Document common options in stable nix binaries (#11663)

This commit is contained in:
Jacek Galowicz 2024-10-10 11:00:01 +02:00 committed by GitHub
parent 4db9487823
commit 39da9462e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,7 @@
<!-- Some of the options documented here are hardcopied from
src/libcmd/common-eval-args.cc
-->
# Common Options
Most Nix commands accept the following command-line options:
@ -161,6 +165,14 @@ Most Nix commands accept the following command-line options:
You can override this using `--arg`, e.g., `nix-env --install --attr pkgname --arg system \"i686-freebsd\"`.
(Note that since the argument is a Nix string literal, you have to escape the quotes.)
- <span id="opt-arg-from-file">[`--arg-from-file`](#opt-arg-from-file)</span> *name* *path*
Pass the contents of file *path* as the argument *name* to Nix functions.
- <span id="opt-arg-from-stdin">[`--arg-from-stdin`](#opt-arg-from-stdin)</span> *name*
Pass the contents of stdin as the argument *name* to Nix functions.
- <span id="opt-argstr">[`--argstr`](#opt-argstr)</span> *name* *value*
This option is like `--arg`, only the value is not a Nix expression but a string.
@ -179,6 +191,10 @@ Most Nix commands accept the following command-line options:
attribute of the fourth element of the array in the `foo` attribute
of the top-level expression.
- <span id="opt-eval-store">[`--eval-store`](#opt-eval-store)</span> *store-url*
The [URL to the Nix store](@docroot@/store/types/index.md#store-url-format) to use for evaluation, i.e. where to store derivations (`.drv` files) and inputs referenced by them.
- <span id="opt-expr">[`--expr`](#opt-expr)</span> / `-E`
Interpret the command line arguments as a list of Nix expressions to be parsed and evaluated, rather than as a list of file names of Nix expressions.
@ -194,6 +210,10 @@ Most Nix commands accept the following command-line options:
Paths added through `-I` take precedence over the [`nix-path` configuration setting](@docroot@/command-ref/conf-file.md#conf-nix-path) and the [`NIX_PATH` environment variable](@docroot@/command-ref/env-common.md#env-NIX_PATH).
- <span id="opt-impure">[`--impure`](#opt-impure)</span>
Allow access to mutable paths and repositories.
- <span id="opt-option">[`--option`](#opt-option)</span> *name* *value*
Set the Nix configuration option *name* to *value*.