Merge pull request #10935 from fricklerhandwerk/cli-docs-formatting

use separate paragraphs inside list items
This commit is contained in:
John Ericson 2024-06-18 15:24:44 -04:00 committed by GitHub
commit 0c6029669d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 646 additions and 548 deletions

View file

@ -27,7 +27,8 @@ The moving parts of channels are:
This command has the following operations:
- `--add` *url* \[*name*\]\
- `--add` *url* \[*name*\]
Add a channel *name* located at *url* to the list of subscribed channels.
If *name* is omitted, default to the last component of *url*, with the suffixes `-stable` or `-unstable` removed.
@ -39,17 +40,21 @@ This command has the following operations:
A channel URL must point to a directory containing a file `nixexprs.tar.gz`.
At the top level, that tarball must contain a single directory with a `default.nix` file that serves as the channels entry point.
- `--remove` *name*\
- `--remove` *name*
Remove the channel *name* from the list of subscribed channels.
- `--list`\
- `--list`
Print the names and URLs of all subscribed channels on standard output.
- `--update` \[*names*…\]\
- `--update` \[*names*…\]
Download the Nix expressions of subscribed channels and create a new generation.
Update all channels if none is specified, and only those included in *names* otherwise.
- `--list-generations`\
- `--list-generations`
Prints a list of all the current existing generations for the
channel profile.
@ -58,7 +63,8 @@ This command has the following operations:
nix-env --profile /nix/var/nix/profiles/per-user/$USER/channels --list-generations
```
- `--rollback` \[*generation*\]\
- `--rollback` \[*generation*\]
Revert channels to the state before the last call to `nix-channel --update`.
Optionally, you can specify a specific channel *generation* number to restore.

View file

@ -48,12 +48,14 @@ Instead, it looks in a few locations, and acts on all profiles it finds there:
These options are for deleting old [profiles] prior to deleting unreachable [store objects].
- <span id="opt-delete-old">[`--delete-old`](#opt-delete-old)</span> / `-d`\
- <span id="opt-delete-old">[`--delete-old`](#opt-delete-old)</span> / `-d`
Delete all old generations of profiles.
This is the equivalent of invoking [`nix-env --delete-generations old`](@docroot@/command-ref/nix-env/delete-generations.md#generations-old) on each found profile.
- <span id="opt-delete-older-than">[`--delete-older-than`](#opt-delete-older-than)</span> *period*\
- <span id="opt-delete-older-than">[`--delete-older-than`](#opt-delete-older-than)</span> *period*
Delete all generations of profiles older than the specified amount (except for the generations that were active at that point in time).
*period* is a value such as `30d`, which would mean 30 days.

View file

@ -12,7 +12,8 @@ This operation deletes the specified generations of the current profile.
*generations* can be a one of the following:
- <span id="generations-list">[`<number>...`](#generations-list)</span>:\
- <span id="generations-list">[`<number>...`](#generations-list)</span>
A list of generation numbers, each one a separate command-line argument.
Delete exactly the profile generations given by their generation number.
@ -30,7 +31,8 @@ This operation deletes the specified generations of the current profile.
> Because one can roll back to a previous generation, it is possible to have generations newer than the current one.
> They will also be deleted.
- <span id="generations-time">[`<number>d`](#generations-time)</span>:\
- <span id="generations-time">[`<number>d`](#generations-time)</span>
The last *number* days
*Example*: `30d`
@ -38,7 +40,8 @@ This operation deletes the specified generations of the current profile.
Delete all generations created more than *number* days ago, except the most recent one of them.
This allows rolling back to generations that were available within the specified period.
- <span id="generations-count">[`+<number>`](#generations-count)</span>:\
- <span id="generations-count">[`+<number>`](#generations-count)</span>
The last *number* generations up to the present
*Example*: `+5`

View file

@ -1,6 +1,7 @@
# Environment variables
- `NIX_PROFILE`\
- `NIX_PROFILE`
Location of the Nix profile. Defaults to the target of the symlink
`~/.nix-profile`, if it exists, or `/nix/var/nix/profiles/default`
otherwise.

View file

@ -2,7 +2,8 @@
The following options are allowed for all `nix-env` operations, but may not always have an effect.
- `--file` / `-f` *path*\
- `--file` / `-f` *path*
Specifies the Nix expression (designated below as the *active Nix
expression*) used by the `--install`, `--upgrade`, and `--query
--available` operations to obtain derivations. The default is
@ -13,13 +14,15 @@ The following options are allowed for all `nix-env` operations, but may not alwa
unpacked to a temporary location. The tarball must include a single
top-level directory containing at least a file named `default.nix`.
- `--profile` / `-p` *path*\
- `--profile` / `-p` *path*
Specifies the profile to be used by those operations that operate on
a profile (designated below as the *active profile*). A profile is a
sequence of user environments called *generations*, one of which is
the *current generation*.
- `--dry-run`\
- `--dry-run`
For the `--install`, `--upgrade`, `--uninstall`,
`--switch-generation`, `--delete-generations` and `--rollback`
operations, this flag will cause `nix-env` to print what *would* be
@ -29,7 +32,7 @@ The following options are allowed for all `nix-env` operations, but may not alwa
[substituted](@docroot@/glossary.md) (i.e., downloaded) and which paths
will be built from source (because no substitute is available).
- `--system-filter` *system*\
By default, operations such as `--query
--available` show derivations matching any platform. This option
- `--system-filter` *system*
By default, operations such as `--query --available` show derivations matching any platform. This option
allows you to use derivations for the specified platform *system*.

View file

@ -35,11 +35,13 @@ The derivations are sorted by their `name` attributes.
The following flags specify the set of things on which the query
operates.
- `--installed`\
- `--installed`
The query operates on the store paths that are installed in the
current generation of the active profile. This is the default.
- `--available`; `-a`\
- `--available` / `-a`
The query operates on the derivations that are available in the
active Nix expression.
@ -50,24 +52,28 @@ selected derivations. Multiple flags may be specified, in which case the
information is shown in the order given here. Note that the name of the
derivation is shown unless `--no-name` is specified.
- `--xml`\
- `--xml`
Print the result in an XML representation suitable for automatic
processing by other tools. The root element is called `items`, which
contains a `item` element for each available or installed
derivation. The fields discussed below are all stored in attributes
of the `item` elements.
- `--json`\
- `--json`
Print the result in a JSON representation suitable for automatic
processing by other tools.
- `--prebuilt-only` / `-b`\
- `--prebuilt-only` / `-b`
Show only derivations for which a substitute is registered, i.e.,
there is a pre-built binary available that can be downloaded in lieu
of building the derivation. Thus, this shows all packages that
probably can be installed quickly.
- `--status`; `-s`\
- `--status` / `-s`
Print the *status* of the derivation. The status consists of three
characters. The first is `I` or `-`, indicating whether the
derivation is currently installed in the current generation of the
@ -78,49 +84,61 @@ derivation is shown unless `--no-name` is specified.
derivation to be built. The third is `S` or `-`, indicating whether
a substitute is available for the derivation.
- `--attr-path`; `-P`\
- `--attr-path` / `-P`
Print the *attribute path* of the derivation, which can be used to
unambiguously select it using the `--attr` option available in
commands that install derivations like `nix-env --install`. This
option only works together with `--available`
- `--no-name`\
- `--no-name`
Suppress printing of the `name` attribute of each derivation.
- `--compare-versions` / `-c`\
- `--compare-versions` / `-c`
Compare installed versions to available versions, or vice versa (if
`--available` is given). This is useful for quickly seeing whether
upgrades for installed packages are available in a Nix expression. A
column is added with the following meaning:
- `<` *version*\
- `<` *version*
A newer version of the package is available or installed.
- `=` *version*\
- `=` *version*
At most the same version of the package is available or
installed.
- `>` *version*\
- `>` *version*
Only older versions of the package are available or installed.
- `- ?`\
- `- ?`
No version of the package is available or installed.
- `--system`\
- `--system`
Print the `system` attribute of the derivation.
- `--drv-path`\
- `--drv-path`
Print the path of the [store derivation](@docroot@/glossary.md#gloss-store-derivation).
- `--out-path`\
- `--out-path`
Print the output path of the derivation.
- `--description`\
- `--description`
Print a short (one-line) description of the derivation, if
available. The description is taken from the `meta.description`
attribute of the derivation.
- `--meta`\
- `--meta`
Print all of the meta-attributes of the derivation. This option is
only available with `--xml` or `--json`.

View file

@ -28,36 +28,42 @@ version is installed.
# Flags
- `--lt`\
- `--lt`
Only upgrade a derivation to newer versions. This is the default.
- `--leq`\
- `--leq`
In addition to upgrading to newer versions, also “upgrade” to
derivations that have the same version. Version are not a unique
identification of a derivation, so there may be many derivations
that have the same version. This flag may be useful to force
“synchronisation” between the installed and available derivations.
- `--eq`\
- `--eq`
*Only* “upgrade” to derivations that have the same version. This may
not seem very useful, but it actually is, e.g., when there is a new
release of Nixpkgs and you want to replace installed applications
with the same versions built against newer dependencies (to reduce
the number of dependencies floating around on your system).
- `--always`\
- `--always`
In addition to upgrading to newer versions, also “upgrade” to
derivations that have the same or a lower version. I.e., derivations
may actually be downgraded depending on what is available in the
active Nix expression.
- `--prebuilt-only` / `-b`\
- `--prebuilt-only` / `-b`
Use only derivations for which a substitute is registered, i.e.,
there is a pre-built binary available that can be downloaded in lieu
of building the derivation. Thus, no packages will be built from
source.
- `--preserve-installed` / `-P`\
- `--preserve-installed` / `-P`
Do not remove derivations with a name matching one of the
derivations being installed. Usually, trying to have two versions of
the same package installed in the same generation of a profile will

View file

@ -29,7 +29,8 @@ md5sum`.
# Options
- `--flat`\
- `--flat`
Print the cryptographic hash of the contents of each regular file *path*.
That is, instead of computing
the hash of the [Nix Archive (NAR)](@docroot@/store/file-system-object/content-address.md#serial-nix-archive) of *path*,
@ -38,43 +39,53 @@ md5sum`.
The result is identical to that produced by the GNU commands
`md5sum` and `sha1sum`.
- `--base16`\
- `--base16`
Print the hash in a hexadecimal representation (default).
- `--base32`\
- `--base32`
Print the hash in a base-32 representation rather than hexadecimal.
This base-32 representation is more compact and can be used in Nix
expressions (such as in calls to `fetchurl`).
- `--base64`\
- `--base64`
Similar to --base32, but print the hash in a base-64 representation,
which is more compact than the base-32 one.
- `--sri`\
- `--sri`
Print the hash in SRI format with base-64 encoding.
The type of hash algorithm will be prepended to the hash string,
followed by a hyphen (-) and the base-64 hash body.
- `--truncate`\
- `--truncate`
Truncate hashes longer than 160 bits (such as SHA-256) to 160 bits.
- `--type` *hashAlgo*\
- `--type` *hashAlgo*
Use the specified cryptographic hash algorithm, which can be one of
`md5`, `sha1`, `sha256`, and `sha512`.
- `--to-base16`\
- `--to-base16`
Dont hash anything, but convert the base-32 hash representation
*hash* to hexadecimal.
- `--to-base32`\
- `--to-base32`
Dont hash anything, but convert the hexadecimal hash representation
*hash* to base-32.
- `--to-base64`\
- `--to-base64`
Dont hash anything, but convert the hexadecimal hash representation
*hash* to base-64.
- `--to-sri`\
- `--to-sri`
Dont hash anything, but convert the hexadecimal hash representation
*hash* to SRI.

View file

@ -30,14 +30,17 @@ standard input.
# Options
- `--add-root` *path*\
- `--add-root` *path*
See the [corresponding option](nix-store.md) in `nix-store`.
- `--parse`\
- `--parse`
Just parse the input files, and print their abstract syntax trees on
standard output as a Nix expression.
- `--eval`\
- `--eval`
Just parse and evaluate the input files, and print the resulting
values on standard output. No instantiation of store derivations
takes place.
@ -80,14 +83,16 @@ standard input.
> </expr>
> ```
- `--find-file`\
- `--find-file`
Look up the given files in Nixs search path (as specified by the
`NIX_PATH` environment variable). If found, print the corresponding
absolute paths on standard output. For instance, if `NIX_PATH` is
`nixpkgs=/home/alice/nixpkgs`, then `nix-instantiate --find-file
nixpkgs/default.nix` will print `/home/alice/nixpkgs/default.nix`.
- `--strict`\
- `--strict`
When used with `--eval`, recursively evaluate list elements and
attributes. Normally, such sub-expressions are left unevaluated
(since the Nix language is lazy).
@ -97,17 +102,20 @@ standard input.
> This option can cause non-termination, because lazy data
> structures can be infinitely large.
- `--json`\
- `--json`
When used with `--eval`, print the resulting value as an JSON
representation of the abstract syntax tree rather than as a Nix expression.
- `--xml`\
- `--xml`
When used with `--eval`, print the resulting value as an XML
representation of the abstract syntax tree rather than as a Nix expression.
The schema is the same as that used by the [`toXML`
built-in](../language/builtins.md).
- `--read-write-mode`\
- `--read-write-mode`
When used with `--eval`, perform evaluation in read/write mode so
nix language features that require it will still work (at the cost
of needing to do instantiation of every evaluated derivation). If

View file

@ -39,23 +39,28 @@ the path of the downloaded file in the Nix store is also printed.
# Options
- `--type` *hashAlgo*\
- `--type` *hashAlgo*
Use the specified cryptographic hash algorithm,
which can be one of `md5`, `sha1`, `sha256`, and `sha512`.
The default is `sha256`.
- `--print-path`\
- `--print-path`
Print the store path of the downloaded file on standard output.
- `--unpack`\
- `--unpack`
Unpack the archive (which must be a tarball or zip file) and add the
result to the Nix store. The resulting hash can be used with
functions such as Nixpkgss `fetchzip` or `fetchFromGitHub`.
- `--executable`\
- `--executable`
Set the executable bit on the downloaded file.
- `--name` *name*\
- `--name` *name*
Override the name of the file in the Nix store. By default, this is
`hash-basename`, where *basename* is the last component of *url*.
Overriding the name is necessary when *basename* contains characters

View file

@ -60,7 +60,8 @@ All options not listed here are passed to `nix-store
--realise`, except for `--arg` and `--attr` / `-A` which are passed to
`nix-instantiate`.
- `--command` *cmd*\
- `--command` *cmd*
In the environment of the derivation, run the shell command *cmd*.
This command is executed in an interactive shell. (Use `--run` to
use a non-interactive shell instead.) However, a call to `exit` is
@ -70,34 +71,40 @@ All options not listed here are passed to `nix-store
drop you into the interactive shell. This can be useful for doing
any additional initialisation.
- `--run` *cmd*\
- `--run` *cmd*
Like `--command`, but executes the command in a non-interactive
shell. This means (among other things) that if you hit Ctrl-C while
the command is running, the shell exits.
- `--exclude` *regexp*\
- `--exclude` *regexp*
Do not build any dependencies whose store path matches the regular
expression *regexp*. This option may be specified multiple times.
- `--pure`\
- `--pure`
If this flag is specified, the environment is almost entirely
cleared before the interactive shell is started, so you get an
environment that more closely corresponds to the “real” Nix build. A
few variables, in particular `HOME`, `USER` and `DISPLAY`, are
retained.
- `--packages` / `-p` *packages*…\
- `--packages` / `-p` *packages*
Set up an environment in which the specified packages are present.
The command line arguments are interpreted as attribute names inside
the Nix Packages collection. Thus, `nix-shell --packages libjpeg openjdk`
will start a shell in which the packages denoted by the attribute
names `libjpeg` and `openjdk` are present.
- `-i` *interpreter*\
- `-i` *interpreter*
The chained script interpreter to be invoked by `nix-shell`. Only
applicable in `#!`-scripts (described below).
- `--keep` *name*\
- `--keep` *name*
When a `--pure` shell is started, keep the listed environment
variables.
@ -105,7 +112,8 @@ All options not listed here are passed to `nix-store
# Environment variables
- `NIX_BUILD_SHELL`\
- `NIX_BUILD_SHELL`
Shell used to start the interactive environment. Defaults to the
`bash` found in `<nixpkgs>`, falling back to the `bash` found in
`PATH` if not found.

View file

@ -16,7 +16,8 @@ public url or broke since the download expression was written.
This operation has the following options:
- `--recursive`\
- `--recursive`
Use recursive instead of flat hashing mode, used when adding
directories to the store.

View file

@ -14,18 +14,21 @@ reachable via file system references from a set of “roots”, are deleted.
The following suboperations may be specified:
- `--print-roots`\
- `--print-roots`
This operation prints on standard output the set of roots used by
the garbage collector.
- `--print-live`\
- `--print-live`
This operation prints on standard output the set of “live” store
paths, which are all the store paths reachable from the roots. Live
paths should never be deleted, since that would break consistency —
it would become possible that applications are installed that
reference things that are no longer present in the store.
- `--print-dead`\
- `--print-dead`
This operation prints out on standard output the set of “dead” store
paths, which is just the opposite of the set of live paths: any path
in the store that is not live (with respect to the roots) is dead.
@ -33,7 +36,8 @@ The following suboperations may be specified:
By default, all unreachable paths are deleted. The following options
control what gets deleted and in what order:
- `--max-freed` *bytes*\
- `--max-freed` *bytes*
Keep deleting paths until at least *bytes* bytes have been deleted,
then stop. The argument *bytes* can be followed by the
multiplicative suffix `K`, `M`, `G` or `T`, denoting KiB, MiB, GiB

View file

@ -24,25 +24,29 @@ symlink.
# Common query options
- `--use-output`; `-u`\
- `--use-output` / `-u`
For each argument to the query that is a [store derivation], apply the
query to the output path of the derivation instead.
- `--force-realise`; `-f`\
- `--force-realise` / `-f`
Realise each argument to the query first (see [`nix-store --realise`](./realise.md)).
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
# Queries
- `--outputs`\
- `--outputs`
Prints out the [output paths] of the store
derivations *paths*. These are the paths that will be produced when
the derivation is built.
[output paths]: @docroot@/glossary.md#gloss-output-path
- `--requisites`; `-R`\
- `--requisites` / `-R`
Prints out the [closure] of the store path *paths*.
[closure]: @docroot@/glossary.md#gloss-closure
@ -61,27 +65,31 @@ symlink.
dependencies) is obtained by distributing the closure of a store
derivation and specifying the option `--include-outputs`.
- `--references`\
- `--references`
Prints the set of [references] of the store paths
*paths*, that is, their immediate dependencies. (For *all*
dependencies, use `--requisites`.)
[references]: @docroot@/glossary.md#gloss-reference
- `--referrers`\
- `--referrers`
Prints the set of *referrers* of the store paths *paths*, that is,
the store paths currently existing in the Nix store that refer to
one of *paths*. Note that contrary to the references, the set of
referrers is not constant; it can change as store paths are added or
removed.
- `--referrers-closure`\
- `--referrers-closure`
Prints the closure of the set of store paths *paths* under the
referrers relation; that is, all store paths that directly or
indirectly refer to one of *paths*. These are all the path currently
in the Nix store that are dependent on *paths*.
- `--deriver`; `-d`\
- `--deriver` / `-d`
Prints the [deriver] that was used to build the store paths *paths*. If
the path has no deriver (e.g., if it is a source file), or if the
deriver is not known (e.g., in the case of a binary-only
@ -92,12 +100,14 @@ symlink.
[deriver]: @docroot@/glossary.md#gloss-deriver
- `--valid-derivers`\
- `--valid-derivers`
Prints a set of derivation files (`.drv`) which are supposed produce
said paths when realized. Might print nothing, for example for source paths
or paths subsituted from a binary cache.
- `--graph`\
- `--graph`
Prints the references graph of the store paths *paths* in the format
of the `dot` tool of AT\&T's [Graphviz
package](http://www.graphviz.org/). This can be used to visualise
@ -105,39 +115,45 @@ symlink.
this to a store derivation. To obtain a runtime dependency graph,
apply it to an output path.
- `--tree`\
- `--tree`
Prints the references graph of the store paths *paths* as a nested
ASCII tree. References are ordered by descending closure size; this
tends to flatten the tree, making it more readable. The query only
recurses into a store path when it is first encountered; this
prevents a blowup of the tree representation of the graph.
- `--graphml`\
- `--graphml`
Prints the references graph of the store paths *paths* in the
[GraphML](http://graphml.graphdrawing.org/) file format. This can be
used to visualise dependency graphs. To obtain a build-time
dependency graph, apply this to a [store derivation]. To obtain a
runtime dependency graph, apply it to an output path.
- `--binding` *name*; `-b` *name*\
- `--binding` *name* / `-b` *name*
Prints the value of the attribute *name* (i.e., environment
variable) of the [store derivation]s *paths*. It is an error for a
derivation to not have the specified attribute.
- `--hash`\
- `--hash`
Prints the SHA-256 hash of the contents of the store paths *paths*
(that is, the hash of the output of `nix-store --dump` on the given
paths). Since the hash is stored in the Nix database, this is a fast
operation.
- `--size`\
- `--size`
Prints the size in bytes of the contents of the store paths *paths*
— to be precise, the size of the output of `nix-store --dump` on
the given paths. Note that the actual disk space required by the
store paths may be higher, especially on filesystems with large
cluster sizes.
- `--roots`\
- `--roots`
Prints the garbage collector roots that point, directly or
indirectly, at the store paths *paths*.

View file

@ -42,15 +42,18 @@ For non-derivation arguments, the argument itself is printed.
# Options
- `--dry-run`\
- `--dry-run`
Print on standard error a description of what packages would be
built or downloaded, without actually performing the operation.
- `--ignore-unknown`\
- `--ignore-unknown`
If a non-derivation path does not have a substitute, then silently
ignore it.
- `--check`\
- `--check`
This option allows you to check whether a derivation is
deterministic. It rebuilds the specified derivation and checks
whether the result is bitwise-identical with the existing outputs,

View file

@ -14,7 +14,8 @@ access to a restricted ssh user.
The following flags are available:
- `--write`\
- `--write`
Allow the connected client to request the realization of
derivations. In effect, this can be used to make the host act as a
remote builder.

View file

@ -16,14 +16,16 @@ being modified by non-Nix tools, or of bugs in Nix itself.
This operation has the following options:
- `--check-contents`\
- `--check-contents`
Checks that the contents of every valid store path has not been
altered by computing a SHA-256 hash of the contents and comparing it
with the hash stored in the Nix database at build time. Paths that
have been modified are printed out. For large stores,
`--check-contents` is obviously quite slow.
- `--repair`\
- `--repair`
If any valid path is missing from the store, or (if
`--check-contents` is given) the contents of a valid path has been
modified, then try to repair the path by redownloading it. See