1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 19:23:54 +02:00

<replaceable> -> <emphasis>

Pandoc doesn't know <replaceable> so let's force it to be rendered as
italics.
This commit is contained in:
Eelco Dolstra 2020-07-23 14:28:05 +02:00
parent ee05108472
commit 802150f987
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
76 changed files with 1029 additions and 1020 deletions

View file

@ -28,8 +28,8 @@ By default Nix reads settings from the following places:
The configuration files consist of `name =
value` pairs, one per line. Other files can be included with a line like
`include
path`, where path is interpreted relative to the current conf file and a
missing file is an error unless `!include` is used instead. Comments
path`, where *path* is interpreted relative to the current conf file and
a missing file is an error unless `!include` is used instead. Comments
start with a `#` character. Here is an example configuration file:
keep-outputs = true # Nice for developers
@ -216,7 +216,7 @@ The following settings are currently available:
- `hashed-mirrors`
A list of web servers used by `builtins.fetchurl` to obtain files by
hash. The default is `http://tarballs.nixos.org/`. Given a hash type
ht and a base-16 hash h, Nix will try to download the file from
*ht* and a base-16 hash *h*, Nix will try to download the file from
`hashed-mirror/ht/h`. This allows files to be downloaded even if
they have disappeared from their original URI. For example, given
the default mirror `http://tarballs.nixos.org/`, when building the
@ -504,8 +504,8 @@ The following settings are currently available:
A list of paths bind-mounted into Nix sandbox environments. You can
use the syntax `target=source` to mount a path in a different
location in the sandbox; for instance, `/bin=/nix-bin` will mount
the path `/nix-bin` as `/bin` inside the sandbox. If source is
followed by `?`, then it is not an error if source does not exist;
the path `/nix-bin` as `/bin` inside the sandbox. If *source* is
followed by `?`, then it is not an error if *source* does not exist;
for example, `/dev/nvidiactl?` specifies that `/dev/nvidiactl` will
only be mounted in the sandbox if it exists in the host filesystem.

View file

@ -43,16 +43,16 @@ paths
# Description
The `nix-build` command builds the derivations described by the Nix
expressions in paths. If the build succeeds, it places a symlink to the
result in the current directory. The symlink is called `result`. If
expressions in *paths*. If the build succeeds, it places a symlink to
the result in the current directory. The symlink is called `result`. If
there are multiple Nix expressions, or the Nix expressions evaluate to
multiple derivations, multiple sequentially numbered symlinks are
created (`result`, `result-2`, and so on).
If no paths are specified, then `nix-build` will use `default.nix` in
If no *paths* are specified, then `nix-build` will use `default.nix` in
the current directory, if it exists.
If an element of paths starts with `http://` or `https://`, it is
If an element of *paths* starts with `http://` or `https://`, it is
interpreted as the URL of a tarball that will be downloaded and unpacked
to a temporary location. The tarball must include a single top-level
directory containing at least a file named `default.nix`.
@ -83,9 +83,9 @@ All options not listed here are passed to `nix-store
- `--dry-run`
Show what store paths would be built or downloaded.
- `--out-link` / `-o` outlink
- `--out-link` / `-o` *outlink*
Change the name of the symlink to the output path created from
`result` to outlink.
`result` to *outlink*.
The following common options are supported:

View file

@ -42,25 +42,26 @@ To see the list of official NixOS channels, visit
This command has the following operations:
- `--add` url \[name\]
Adds a channel named name with URL url to the list of subscribed
channels. If name is omitted, it defaults to the last component of
url, with the suffixes `-stable` or `-unstable` removed.
- `--add` *url* \[*name*\]
Adds a channel named *name* with URL *url* to the list of subscribed
channels. If *name* is omitted, it defaults to the last component of
*url*, with the suffixes `-stable` or `-unstable` removed.
- `--remove` name
Removes the channel named name from the list of subscribed channels.
- `--remove` *name*
Removes the channel named *name* from the list of subscribed
channels.
- `--list`
Prints the names and URLs of all subscribed channels on standard
output.
- `--update` \[names…\]
- `--update` \[*names*…\]
Downloads the Nix expressions of all subscribed channels (or only
those included in names if specified) and makes them the default for
`nix-env` operations (by symlinking them from the directory
those included in *names* if specified) and makes them the default
for `nix-env` operations (by symlinking them from the directory
`~/.nix-defexpr`).
- `--rollback` \[generation\]
- `--rollback` \[*generation*\]
Reverts the previous call to `nix-channel
--update`. Optionally, you can specify a specific channel generation
number to restore.

View file

@ -33,7 +33,7 @@ additional options: `-d` (`--delete-old`), which deletes all old
generations of all profiles in `/nix/var/nix/profiles` by invoking
`nix-env --delete-generations old` on all profiles (of course, this
makes rollbacks to previous configurations impossible); and
`--delete-older-than` period, where period is a value such as `30d`,
`--delete-older-than` *period*, where period is a value such as `30d`,
which deletes all generations older than the specified number of days in
all profiles in `/nix/var/nix/profiles` (except for the generations that
were active at that point in time).

View file

@ -98,7 +98,7 @@ This section lists the options that are common to all operations. These
options are allowed for every subcommand, though they may not always
have an effect. See also [???](#sec-common-options).
- `--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
@ -109,7 +109,7 @@ have an effect. See also [???](#sec-common-options).
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
@ -125,10 +125,10 @@ have an effect. See also [???](#sec-common-options).
[substituted](#gloss-substitute) (i.e., downloaded) and which paths
will be built from source (because no substitute is available).
- `--system-filter` system
- `--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.
allows you to use derivations for the specified platform *system*.
<!-- end list -->
@ -200,17 +200,17 @@ args
The install operation creates a new user environment, based on the
current generation of the active profile, to which a set of store paths
described by args is added. The arguments args map to store paths in a
number of possible ways:
described by *args* is added. The arguments *args* map to store paths in
a number of possible ways:
- By default, args is a set of derivation names denoting derivations
- By default, *args* is a set of derivation names denoting derivations
in the active Nix expression. These are realised, and the resulting
output paths are installed. Currently installed derivations with a
name equal to the name of a derivation being added are removed
unless the option `--preserve-installed` is specified.
If there are multiple derivations matching a name in args that have
the same name (e.g., `gcc-3.3.6` and `gcc-4.1.1`), then the
If there are multiple derivations matching a name in *args* that
have the same name (e.g., `gcc-3.3.6` and `gcc-4.1.1`), then the
derivation with the highest *priority* is used. A derivation can
define a priority by declaring the `meta.priority` attribute. This
attribute should be a number, with a higher value denoting a lower
@ -230,22 +230,23 @@ number of possible ways:
unambiguous. To find out the attribute paths of available packages,
use `nix-env -qaP`.
- If `--from-profile` path is given, args is a set of names denoting
installed store paths in the profile path. This is an easy way to
copy user environment elements from one profile to another.
- If `--from-profile` *path* is given, *args* is a set of names
denoting installed store paths in the profile *path*. This is an
easy way to copy user environment elements from one profile to
another.
- If `--from-expression` is given, args are Nix
- If `--from-expression` is given, *args* are Nix
[functions](#ss-functions) that are called with the active Nix
expression as their single argument. The derivations returned by
those function calls are installed. This allows derivations to be
specified in an unambiguous way, which is necessary if there are
multiple derivations with the same name.
- If args are store derivations, then these are
- If *args* are store derivations, then these are
[realised](#rsec-nix-store-realise), and the resulting output paths
are installed.
- If args are store paths that are not store derivations, then these
- If *args* are store paths that are not store derivations, then these
are [realised](#rsec-nix-store-realise) and installed.
- By default all outputs are installed for each derivation. That can
@ -359,12 +360,12 @@ args
The upgrade operation creates a new user environment, based on the
current generation of the active profile, in which all store paths are
replaced for which there are newer versions in the set of paths
described by args. Paths for which there are no newer versions are left
untouched; this is not an error. It is also not an error if an element
of args matches no installed derivations.
described by *args*. Paths for which there are no newer versions are
left untouched; this is not an error. It is also not an error if an
element of *args* matches no installed derivations.
For a description of how args is mapped to a set of store paths, see
[`--install`](#rsec-nix-env-install). If args describes multiple store
For a description of how *args* is mapped to a set of store paths, see
[`--install`](#rsec-nix-env-install). If *args* describes multiple store
paths with the same symbolic name, only the one with the highest version
is installed.
@ -462,7 +463,7 @@ drvnames
The uninstall operation creates a new user environment, based on the
current generation of the active profile, from which the store paths
designated by the symbolic names names are removed.
designated by the symbolic names *names* are removed.
## Examples
@ -629,7 +630,7 @@ The query operation displays information about either the store paths
that are installed in the current generation of the active profile
(`--installed`), or the derivations that are available for installation
in the active Nix expression (`--available`). It only prints information
about derivations whose symbolic name matches one of names.
about derivations whose symbolic name matches one of *names*.
The derivations are sorted by their `name` attributes.
@ -696,14 +697,14 @@ derivation is shown unless `--no-name` is specified.
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.
- `- ?`
@ -806,8 +807,8 @@ path
## Description
This operation makes path the current profile for the user. That is, the
symlink `~/.nix-profile` is made to point to path.
This operation makes *path* the current profile for the user. That is,
the symlink `~/.nix-profile` is made to point to *path*.
## Examples
@ -882,9 +883,9 @@ generation
## Description
This operation makes generation number generation the current generation
of the active profile. That is, if the `profile` is the path to the
active profile, then the symlink `profile` is made to point to
This operation makes generation number *generation* the current
generation of the active profile. That is, if the `profile` is the path
to the active profile, then the symlink `profile` is made to point to
`profile-generation-link`, which is in turn a symlink to the actual user
environment in the Nix store.

View file

@ -37,7 +37,7 @@ hash
# Description
The command `nix-hash` computes the cryptographic hash of the contents
of each path and prints it on standard output. By default, it computes
of each *path* and prints it on standard output. By default, it computes
an MD5 hash, but other hash algorithms are available as well. The hash
is printed in hexadecimal. To generate the same hash as
`nix-prefetch-url` you have to specify multiple arguments, see below for
@ -55,9 +55,9 @@ path | md5sum`.
- `--flat`
Print the cryptographic hash of the contents of each regular file
path. That is, do not compute the hash over the dump of path. The
result is identical to that produced by the GNU commands `md5sum`
and `sha1sum`.
*path*. That is, do not compute the hash over the dump of *path*.
The result is identical to that produced by the GNU commands
`md5sum` and `sha1sum`.
- `--base32`
Print the hash in a base-32 representation rather than hexadecimal.
@ -67,17 +67,17 @@ path | md5sum`.
- `--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`, and `sha256`.
- `--to-base16`
Dont hash anything, but convert the base-32 hash representation
hash to hexadecimal.
*hash* to hexadecimal.
- `--to-base32`
Dont hash anything, but convert the hexadecimal hash representation
hash to base-32.
*hash* to base-32.
# Examples

View file

@ -56,19 +56,19 @@ files
The command `nix-instantiate` generates [store
derivations](#gloss-derivation) from (high-level) Nix expressions. It
evaluates the Nix expressions in each of files (which defaults to
./default.nix). Each top-level expression should evaluate to a
evaluates the Nix expressions in each of *files* (which defaults to
*./default.nix*). Each top-level expression should evaluate to a
derivation, a list of derivations, or a set of derivations. The paths of
the resulting store derivations are printed on standard output.
If files is the character `-`, then a Nix expression will be read from
If *files* is the character `-`, then a Nix expression will be read from
standard input.
See also [???](#sec-common-options) for a list of common options.
# Options
- `--add-root` path; `--indirect`
- `--add-root` *path*; `--indirect`
See the [corresponding options](#opt-add-root) in `nix-store`.
- `--parse`

View file

@ -31,9 +31,9 @@ hash
# Description
The command `nix-prefetch-url` downloads the file referenced by the URL
url, prints its cryptographic hash, and copies it into the Nix store.
The file name in the store is `hash-baseName`, where baseName is
everything following the final slash in url.
*url*, prints its cryptographic hash, and copies it into the Nix store.
The file name in the store is `hash-baseName`, where *baseName* is
everything following the final slash in *url*.
This command is just a convenience for Nix expression writers. Often a
Nix expression fetches some source distribution from the network using
@ -44,10 +44,10 @@ again when you build your Nix expression. Since `fetchurl` uses the same
name for the downloaded file as `nix-prefetch-url`, the redundant
download can be avoided.
If hash is specified, then a download is not performed if the Nix store
already contains a file with the same hash and base name. Otherwise, the
file is downloaded, and an error is signaled if the actual hash of the
file does not match the specified hash.
If *hash* is specified, then a download is not performed if the Nix
store already contains a file with the same hash and base name.
Otherwise, the file is downloaded, and an error is signaled if the
actual hash of the file does not match the specified hash.
This command prints the hash on standard output. Additionally, if the
option `--print-path` is used, the path of the downloaded file in the
@ -55,7 +55,7 @@ Nix store is also printed.
# Options
- `--type` hashAlgo
- `--type` *hashAlgo*
Use the specified cryptographic hash algorithm, which can be one of
`md5`, `sha1`, and `sha256`.
@ -67,10 +67,10 @@ Nix store is also printed.
result to the Nix store. The resulting hash can be used with
functions such as Nixpkgss `fetchzip` or `fetchFromGitHub`.
- `--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
`hash-basename`, where *basename* is the last component of *url*.
Overriding the name is necessary when *basename* contains characters
that are not allowed in Nix store paths.
# Examples

View file

@ -61,14 +61,14 @@ path
The command `nix-shell` will build the dependencies of the specified
derivation, but not the derivation itself. It will then start an
interactive shell in which all environment variables defined by the
derivation path have been set to their corresponding values, and the
derivation *path* have been set to their corresponding values, and the
script `$stdenv/setup` has been sourced. This is useful for reproducing
the environment of a derivation for development.
If path is not given, `nix-shell` defaults to `shell.nix` if it exists,
and `default.nix` otherwise.
If *path* is not given, `nix-shell` defaults to `shell.nix` if it
exists, and `default.nix` otherwise.
If path starts with `http://` or `https://`, it is interpreted as the
If *path* starts with `http://` or `https://`, it is interpreted as the
URL of a tarball that will be downloaded and unpacked to a temporary
location. The tarball must include a single top-level directory
containing at least a file named `default.nix`.
@ -91,8 +91,8 @@ All options not listed here are passed to `nix-store
--realise`, except for `--arg` and `--attr` / `-A` which are passed to
`nix-instantiate`. See also [???](#sec-common-options).
- `--command` cmd
In the environment of the derivation, run the shell 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
implicitly added to the command, so the shell will exit after
@ -102,14 +102,14 @@ All options not listed here are passed to `nix-store
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.
expression *regexp*. This option may be specified multiple times.
- `--pure`
If this flag is specified, the environment is almost entirely
@ -120,19 +120,19 @@ All options not listed here are passed to `nix-store
installation) `/etc/bashrc` are still sourced, so any variables set
there will affect the interactive shell.
- `--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 -p 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](#ssec-nix-shell-shebang)).
- `--keep` name
- `--keep` *name*
When a `--pure` shell is started, keep the listed environment
variables.
@ -199,10 +199,10 @@ done by starting the script with the following lines:
#! /usr/bin/env nix-shell
#! nix-shell -i real-interpreter -p packages
where real-interpreter is the “real” script interpreter that will be
where *real-interpreter* is the “real” script interpreter that will be
invoked by `nix-shell` after it has obtained the dependencies and
initialised the environment, and packages are the attribute names of the
dependencies in Nixpkgs.
initialised the environment, and *packages* are the attribute names of
the dependencies in Nixpkgs.
The lines starting with `#! nix-shell` specify `nix-shell` options (see
above). Note that you cannot write `#! /usr/bin/env nix-shell -i ...`

View file

@ -37,10 +37,10 @@ options are allowed for every subcommand, though they may not always
have an effect. See also [???](#sec-common-options) for a list of common
options.
- `--add-root` path
- `--add-root` *path*
Causes the result of a realisation (`--realise` and
`--force-realise`) to be registered as a root of the garbage
collector(see [???](#ssec-gc-roots)). The root is stored in path,
collector(see [???](#ssec-gc-roots)). The root is stored in *path*,
which must be inside a directory that is scanned for roots by the
garbage collector (i.e., typically in a subdirectory of
`/nix/var/nix/gcroots/`) *unless* the `--indirect` flag is used.
@ -56,8 +56,8 @@ options.
result in the current directory; such a build result should not be
garbage-collected unless the symlink is removed.
The `--indirect` flag causes a uniquely named symlink to path to be
stored in `/nix/var/nix/gcroots/auto/`. For instance,
The `--indirect` flag causes a uniquely named symlink to *path* to
be stored in `/nix/var/nix/gcroots/auto/`. For instance,
$ nix-store --add-root /home/eelco/bla/result --indirect -r ...
@ -262,10 +262,11 @@ 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
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 or TiB units.
- `--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
or TiB units.
The behaviour of the collector is also influenced by the
[`keep-outputs`](#conf-keep-outputs) and
@ -303,7 +304,7 @@ paths
## Description
The operation `--delete` deletes the store paths paths from the Nix
The operation `--delete` deletes the store paths *paths* from the Nix
store, but only if it is safe to do so; that is, when the path is not
reachable from a root of the garbage collector. This means that you can
only delete paths that would also be deleted by `nix-store --gc`. Thus,
@ -379,7 +380,7 @@ The operation `--query` displays various bits of information about the
store paths . The queries are described below. At most one query can be
specified. The default query is `--outputs`.
The paths paths may also be symlinks from outside of the Nix store, to
The paths *paths* may also be symlinks from outside of the Nix store, to
the Nix store. In that case, the query is applied to the target of the
symlink.
@ -397,11 +398,11 @@ symlink.
- `--outputs`
Prints out the [output paths](#gloss-output-path) of the store
derivations paths. These are the paths that will be produced when
derivations *paths*. These are the paths that will be produced when
the derivation is built.
- `--requisites`; `-R`
Prints out the [closure](#gloss-closure) of the store path paths.
Prints out the [closure](#gloss-closure) of the store path *paths*.
This query has one option:
@ -419,29 +420,30 @@ symlink.
- `--references`
Prints the set of [references](#gloss-reference) of the store paths
paths, that is, their immediate dependencies. (For *all*
*paths*, that is, their immediate dependencies. (For *all*
dependencies, use `--requisites`.)
- `--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.
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`
Prints the closure of the set of store paths paths under the
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.
indirectly refer to one of *paths*. These are all the path currently
in the Nix store that are dependent on *paths*.
- `--deriver`; `-d`
Prints the [deriver](#gloss-deriver) of the store paths paths. If
Prints the [deriver](#gloss-deriver) of 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
deployment), the string `unknown-deriver` is printed.
- `--graph`
Prints the references graph of the store paths paths in the format
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
dependency graphs. To obtain a build-time dependency graph, apply
@ -449,40 +451,40 @@ symlink.
apply it to an output path.
- `--tree`
Prints the references graph of the store paths paths as a nested
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`
Prints the references graph of the store paths paths in the
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
Prints the value of the attribute name (i.e., environment variable)
of the store derivations paths. It is an error for a derivation to
not have the specified attribute.
- `--binding` *name*; `-b` *name*
Prints the value of the attribute *name* (i.e., environment
variable) of the store derivations *paths*. It is an error for a
derivation to not have the specified attribute.
- `--hash`
Prints the SHA-256 hash of the contents of the store paths paths
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`
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.
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`
Prints the garbage collector roots that point, directly or
indirectly, at the store paths paths.
indirectly, at the store paths *paths*.
## Examples
@ -708,8 +710,8 @@ path
## Description
The operation `--dump` produces a NAR (Nix ARchive) file containing the
contents of the file system tree rooted at path. The archive is written
to standard output.
contents of the file system tree rooted at *path*. The archive is
written to standard output.
A NAR archive is like a TAR or Zip archive, but it contains only the
information that Nix considers important. For instance, timestamps are
@ -745,8 +747,8 @@ path
## Description
The operation `--restore` unpacks a NAR archive to path, which must not
already exist. The archive is read from standard input.
The operation `--restore` unpacks a NAR archive to *path*, which must
not already exist. The archive is read from standard input.
# Operation `--export`

View file

@ -44,9 +44,9 @@ Most Nix commands accept the following command-line options:
This option may be specified repeatedly. See the previous verbosity
levels list.
- `--log-format` format
- `--log-format` *format*
This option can be used to change the output of the log format, with
format being one of:
*format* being one of:
- raw
This is the raw format, as outputted by nix-build.
@ -68,7 +68,7 @@ Most Nix commands accept the following command-line options:
output and error are always written to a log file in
`prefix/nix/var/log/nix`.
- `--max-jobs` / `-j` number
- `--max-jobs` / `-j` *number*
Sets the maximum number of build jobs that Nix will perform in
parallel to the specified number. Specify `auto` to use the number
of CPUs in the system. The default is specified by the
@ -144,7 +144,7 @@ Most Nix commands accept the following command-line options:
database. Most Nix operations do need database access, so those
operations will fail.
- `--arg` name value
- `--arg` *name* *value*
This option is accepted by `nix-env`, `nix-instantiate`, `nix-shell`
and `nix-build`. When evaluating Nix expressions, the expression
evaluator will automatically try to call functions that it
@ -153,8 +153,8 @@ Most Nix commands accept the following command-line options:
defaultValue }:
...`). With `--arg`, you can also call functions that have arguments
without a default value (or override a default value). That is, if
the evaluator encounters a function with an argument named name, it
will call it with value value.
the evaluator encounters a function with an argument named *name*,
it will call it with value *value*.
For instance, the top-level `default.nix` in Nixpkgs is actually a
function:
@ -172,18 +172,18 @@ Most Nix commands accept the following command-line options:
\"i686-freebsd\"`. (Note that since the argument is a Nix string
literal, you have to escape the quotes.)
- `--argstr` name value
- `--argstr` *name* *value*
This option is like `--arg`, only the value is not a Nix expression
but a string. So instead of `--arg system \"i686-linux\"` (the outer
quotes are to keep the shell happy) you can say `--argstr system
i686-linux`.
- `--attr` / `-A` attrPath
- `--attr` / `-A` *attrPath*
Select an attribute from the top-level Nix expression being
evaluated. (`nix-env`, `nix-instantiate`, `nix-build` and
`nix-shell` only.) The *attribute path* attrPath is a sequence of
`nix-shell` only.) The *attribute path* *attrPath* is a sequence of
attribute names separated by dots. For instance, given a top-level
Nix expression e, the attribute path `xorg.xorgserver` would cause
Nix expression *e*, the attribute path `xorg.xorgserver` would cause
the expression `e.xorg.xorgserver` to be used. See [`nix-env
--install`](#refsec-nix-env-install-examples) for some concrete
examples.
@ -204,14 +204,14 @@ Most Nix commands accept the following command-line options:
use, give your expression to the `nix-shell -p` convenience flag
instead.
- `-I` path
- `-I` *path*
Add a path to the Nix expression search path. This option may be
given multiple times. See the NIX\_PATH\</literal\> environment
variable for information on the semantics of the Nix search path.
Paths added through `-I` take precedence over `NIX_PATH`.
- `--option` name value
Set the Nix configuration option name to value. This overrides
- `--option` *name* *value*
Set the Nix configuration option *name* to *value*. This overrides
settings in the Nix configuration file (see nix.conf5).
- `--repair`

View file

@ -54,9 +54,9 @@ Derivations can declare some infrequently used optional attributes.
attribute should be a list of pairs `[ name1
path1 name2
path2 ...
]`. The references graph of each pathN will be stored in a text file
nameN in the temporary build directory. The text files have the
format used by `nix-store
]`. The references graph of each *pathN* will be stored in a text
file *nameN* in the temporary build directory. The text files have
the format used by `nix-store
--register-validity` (with the deriver fields left empty). For
example, when the following derivation is built:
@ -204,9 +204,9 @@ Derivations can declare some infrequently used optional attributes.
then when the builder runs, the environment variable `bigPath` will
contain the absolute path to a temporary file containing `a very
long
string`. That is, for any attribute x listed in `passAsFile`, Nix
string`. That is, for any attribute *x* listed in `passAsFile`, Nix
will pass an environment variable `xPath` holding the path of the
file containing the value of attribute x. This is useful when you
file containing the value of attribute *x*. This is useful when you
need to pass large strings to a builder, since most operating
systems impose a limit on the size of the environment (typically, a
few hundred kilobyte).

View file

@ -9,42 +9,42 @@ scope. Instead, you can access them through the `builtins` built-in
value, which is a set that contains all built-in functions and values.
For instance, `derivation` is also available as `builtins.derivation`.
- `abort` s; `builtins.abort` s
Abort Nix expression evaluation, print error message s.
- `abort` *s*; `builtins.abort` *s*
Abort Nix expression evaluation, print error message *s*.
- `builtins.add` e1 e2
Return the sum of the numbers e1 and e2.
- `builtins.add` *e1* *e2*
Return the sum of the numbers *e1* and *e2*.
- `builtins.all` pred list
Return `true` if the function pred returns `true` for all elements
of list, and `false` otherwise.
- `builtins.all` *pred* *list*
Return `true` if the function *pred* returns `true` for all elements
of *list*, and `false` otherwise.
- `builtins.any` pred list
Return `true` if the function pred returns `true` for at least one
element of list, and `false` otherwise.
- `builtins.any` *pred* *list*
Return `true` if the function *pred* returns `true` for at least one
element of *list*, and `false` otherwise.
- `builtins.attrNames` set
Return the names of the attributes in the set set in an
- `builtins.attrNames` *set*
Return the names of the attributes in the set *set* in an
alphabetically sorted list. For instance, `builtins.attrNames { y
= 1; x = "foo"; }` evaluates to `[ "x" "y" ]`.
- `builtins.attrValues` set
Return the values of the attributes in the set set in the order
- `builtins.attrValues` *set*
Return the values of the attributes in the set *set* in the order
corresponding to the sorted attribute names.
- `baseNameOf` s
Return the *base name* of the string s, that is, everything
- `baseNameOf` *s*
Return the *base name* of the string *s*, that is, everything
following the final slash in the string. This is similar to the GNU
`basename` command.
- `builtins.bitAnd` e1 e2
Return the bitwise AND of the integers e1 and e2.
- `builtins.bitAnd` *e1* *e2*
Return the bitwise AND of the integers *e1* and *e2*.
- `builtins.bitOr` e1 e2
Return the bitwise OR of the integers e1 and e2.
- `builtins.bitOr` *e1* *e2*
Return the bitwise OR of the integers *e1* and *e2*.
- `builtins.bitXor` e1 e2
Return the bitwise XOR of the integers e1 and e2.
- `builtins.bitXor` *e1* *e2*
Return the bitwise XOR of the integers *e1* and *e2*.
- `builtins`
The set `builtins` contains all the built-in functions and values.
@ -56,17 +56,17 @@ For instance, `derivation` is also available as `builtins.derivation`.
This allows a Nix expression to fall back gracefully on older Nix
installations that dont have the desired built-in function.
- `builtins.compareVersions` s1 s2
- `builtins.compareVersions` *s1* *s2*
Compare two strings representing versions and return `-1` if version
s1 is older than version s2, `0` if they are the same, and `1` if s1
is newer than s2. The version comparison algorithm is the same as
the one used by [`nix-env
*s1* is older than version *s2*, `0` if they are the same, and `1`
if *s1* is newer than *s2*. The version comparison algorithm is the
same as the one used by [`nix-env
-u`](#ssec-version-comparisons).
- `builtins.concatLists` lists
- `builtins.concatLists` *lists*
Concatenate a list of lists into a single list.
- `builtins.concatStringsSep` separator list
- `builtins.concatStringsSep` *separator* *list*
Concatenate a list of strings with a separator between each element,
e.g. `concatStringsSep "/"
["usr" "local" "bin"] == "usr/local/bin"`
@ -76,37 +76,37 @@ For instance, `derivation` is also available as `builtins.derivation`.
identifier for the Nix installation on which the expression is being
evaluated, such as `"i686-linux"` or `"x86_64-darwin"`.
- `builtins.deepSeq` e1 e2
- `builtins.deepSeq` *e1* *e2*
This is like `seq
e1
e2`, except that e1 is evaluated *deeply*: if its a list or set,
e2`, except that *e1* is evaluated *deeply*: if its a list or set,
its elements or attributes are also evaluated recursively.
- `derivation` attrs; `builtins.derivation` attrs
- `derivation` *attrs*; `builtins.derivation` *attrs*
`derivation` is described in [???](#ssec-derivation).
- `dirOf` s; `builtins.dirOf` s
Return the directory part of the string s, that is, everything
- `dirOf` *s*; `builtins.dirOf` *s*
Return the directory part of the string *s*, that is, everything
before the final slash in the string. This is similar to the GNU
`dirname` command.
- `builtins.div` e1 e2
Return the quotient of the numbers e1 and e2.
- `builtins.div` *e1* *e2*
Return the quotient of the numbers *e1* and *e2*.
- `builtins.elem` x xs
Return `true` if a value equal to x occurs in the list xs, and
- `builtins.elem` *x* *xs*
Return `true` if a value equal to *x* occurs in the list *xs*, and
`false` otherwise.
- `builtins.elemAt` xs n
Return element n from the list xs. Elements are counted starting
- `builtins.elemAt` *xs* *n*
Return element *n* from the list *xs*. Elements are counted starting
from 0. A fatal error occurs if the index is out of bounds.
- `builtins.fetchurl` url
- `builtins.fetchurl` *url*
Download the specified URL and return the path of the downloaded
file. This function is not available if [restricted evaluation
mode](#conf-restrict-eval) is enabled.
- `fetchTarball` url; `builtins.fetchTarball` url
- `fetchTarball` *url*; `builtins.fetchTarball` *url*
Download the specified URL, unpack it and return the path of the
unpacked tree. The file must be a tape archive (`.tar`) compressed
with `gzip`, `bzip2` or `xz`. The top-level path component of the
@ -142,10 +142,10 @@ For instance, `derivation` is also available as `builtins.derivation`.
This function is not available if [restricted evaluation
mode](#conf-restrict-eval) is enabled.
- `builtins.fetchGit` args
Fetch a path from git. args can be a URL, in which case the HEAD of
the repo at that URL is fetched. Otherwise, it can be an attribute
with the following attributes (all except `url` optional):
- `builtins.fetchGit` *args*
Fetch a path from git. *args* can be a URL, in which case the HEAD
of the repo at that URL is fetched. Otherwise, it can be an
attribute with the following attributes (all except `url` optional):
- url
The URL of the repo.
@ -240,11 +240,11 @@ For instance, `derivation` is also available as `builtins.derivation`.
>
> This behavior is disabled in *Pure evaluation mode*.
- `builtins.filter` f xs
Return a list consisting of the elements of xs for which the
function f returns `true`.
- `builtins.filter` *f* *xs*
Return a list consisting of the elements of *xs* for which the
function *f* returns `true`.
- `builtins.filterSource` e1 e2
- `builtins.filterSource` *e1* *e2*
This function allows you to copy sources into the Nix store while
filtering certain files. For instance, suppose that you want to use
the directory `source-dir` as an input to a Nix expression, e.g.
@ -266,9 +266,9 @@ For instance, `derivation` is also available as `builtins.derivation`.
./source-dir;
```
Thus, the first argument e1 must be a predicate function that is
Thus, the first argument *e1* must be a predicate function that is
called for each regular file, directory or symlink in the source
tree e2. If the function returns `true`, the file is copied to the
tree *e2*. If the function returns `true`, the file is copied to the
Nix store, otherwise it is omitted. The function is called with two
arguments. The first is the full path of the file. The second is a
string that identifies the type of the file, which is either
@ -276,19 +276,19 @@ For instance, `derivation` is also available as `builtins.derivation`.
kinds of files such as device nodes or fifos — but note that those
cannot be copied to the Nix store, so if the predicate returns
`true` for them, the copy will fail). If you exclude a directory,
the entire corresponding subtree of e2 will be excluded.
the entire corresponding subtree of *e2* will be excluded.
- `builtins.foldl` op nul list
- `builtins.foldl` *op* *nul* *list*
Reduce a list by applying a binary operator, from left to right,
e.g. `foldl op nul [x0 x1 x2 ...] = op (op
(op nul x0) x1) x2) ...`. The operator is applied strictly, i.e.,
its arguments are evaluated first. For example, `foldl (x: y: x +
y) 0 [1 2 3]` evaluates to 6.
- `builtins.functionArgs` f
- `builtins.functionArgs` *f*
Return a set containing the names of the formal arguments expected
by the function f. The value of each attribute is a Boolean denoting
whether the corresponding argument has a default value. For
by the function *f*. The value of each attribute is a Boolean
denoting whether the corresponding argument has a default value. For
instance, `functionArgs ({ x, y ? 123}: ...) = { x = false; y =
true; }`.
@ -296,7 +296,7 @@ For instance, `derivation` is also available as `builtins.derivation`.
the function. Plain lambdas are not included, e.g. `functionArgs (x:
...) = { }`.
- `builtins.fromJSON` e
- `builtins.fromJSON` *e*
Convert a JSON string to a Nix value. For example,
builtins.fromJSON ''{"x": [1, 2, 3], "y": null}''
@ -304,21 +304,22 @@ For instance, `derivation` is also available as `builtins.derivation`.
returns the value `{ x = [ 1 2 3 ]; y = null;
}`.
- `builtins.genList` generator length
Generate list of size length, with each element i equal to the value
returned by generator `i`. For example,
- `builtins.genList` *generator* *length*
Generate list of size *length*, with each element *i* equal to the
value returned by *generator* `i`. For example,
builtins.genList (x: x * x) 5
returns the list `[ 0 1 4 9 16 ]`.
- `builtins.getAttr` s set
`getAttr` returns the attribute named s from set. Evaluation aborts
if the attribute doesnt exist. This is a dynamic version of the `.`
operator, since s is an expression rather than an identifier.
- `builtins.getAttr` *s* *set*
`getAttr` returns the attribute named *s* from *set*. Evaluation
aborts if the attribute doesnt exist. This is a dynamic version of
the `.` operator, since *s* is an expression rather than an
identifier.
- `builtins.getEnv` s
`getEnv` returns the value of the environment variable s, or an
- `builtins.getEnv` *s*
`getEnv` returns the value of the environment variable *s*, or an
empty string if the variable doesnt exist. This function should be
used with care, as it can introduce all sorts of nasty environment
dependencies in your Nix expression.
@ -328,29 +329,29 @@ For instance, `derivation` is also available as `builtins.derivation`.
Packages. (That is, it does a `getEnv "HOME"` to locate the users
home directory.)
- `builtins.hasAttr` s set
`hasAttr` returns `true` if set has an attribute named s, and
- `builtins.hasAttr` *s* *set*
`hasAttr` returns `true` if *set* has an attribute named *s*, and
`false` otherwise. This is a dynamic version of the `?` operator,
since s is an expression rather than an identifier.
since *s* is an expression rather than an identifier.
- `builtins.hashString` type s
- `builtins.hashString` *type* *s*
Return a base-16 representation of the cryptographic hash of string
s. The hash algorithm specified by type must be one of `"md5"`,
*s*. The hash algorithm specified by *type* must be one of `"md5"`,
`"sha1"`, `"sha256"` or `"sha512"`.
- `builtins.hashFile` type p
- `builtins.hashFile` *type* *p*
Return a base-16 representation of the cryptographic hash of the
file at path p. The hash algorithm specified by type must be one of
`"md5"`, `"sha1"`, `"sha256"` or `"sha512"`.
file at path *p*. The hash algorithm specified by *type* must be one
of `"md5"`, `"sha1"`, `"sha256"` or `"sha512"`.
- `builtins.head` list
- `builtins.head` *list*
Return the first element of a list; abort evaluation if the argument
isnt a list or is an empty list. You can test whether a list is
empty by comparing it with `[]`.
- `import` path; `builtins.import` path
Load, parse and return the Nix expression in the file path. If path
is a directory, the file ` default.nix
- `import` *path*; `builtins.import` *path*
Load, parse and return the Nix expression in the file *path*. If
*path* is a directory, the file ` default.nix
` in that directory is loaded. Evaluation aborts if the file
doesnt exist or contains an incorrect Nix expression. `import`
implements Nixs module system: you can put any Nix expression (such
@ -361,7 +362,8 @@ For instance, `derivation` is also available as `builtins.derivation`.
>
> Unlike some languages, `import` is a regular function in Nix.
> Paths using the angle bracket syntax (e.g., `
> > > > > import` \<foo\>) are normal path values (see [???](#ssec-values)).
> > > > > import` *\<foo\>*) are normal path values (see
> [???](#ssec-values)).
A Nix expression loaded by `import` must not contain any *free
variables* (identifiers that are not defined in the Nix expression
@ -393,50 +395,50 @@ For instance, `derivation` is also available as `builtins.derivation`.
(The function argument doesnt have to be called `x` in `foo.nix`;
any name would work.)
- `builtins.intersectAttrs` e1 e2
Return a set consisting of the attributes in the set e2 that also
exist in the set e1.
- `builtins.intersectAttrs` *e1* *e2*
Return a set consisting of the attributes in the set *e2* that also
exist in the set *e1*.
- `builtins.isAttrs` e
Return `true` if e evaluates to a set, and `false` otherwise.
- `builtins.isAttrs` *e*
Return `true` if *e* evaluates to a set, and `false` otherwise.
- `builtins.isList` e
Return `true` if e evaluates to a list, and `false` otherwise.
- `builtins.isList` *e*
Return `true` if *e* evaluates to a list, and `false` otherwise.
- `builtins.isFunction` e
Return `true` if e evaluates to a function, and `false` otherwise.
- `builtins.isFunction` *e*
Return `true` if *e* evaluates to a function, and `false` otherwise.
- `builtins.isString` e
Return `true` if e evaluates to a string, and `false` otherwise.
- `builtins.isString` *e*
Return `true` if *e* evaluates to a string, and `false` otherwise.
- `builtins.isInt` e
Return `true` if e evaluates to an int, and `false` otherwise.
- `builtins.isInt` *e*
Return `true` if *e* evaluates to an int, and `false` otherwise.
- `builtins.isFloat` e
Return `true` if e evaluates to a float, and `false` otherwise.
- `builtins.isFloat` *e*
Return `true` if *e* evaluates to a float, and `false` otherwise.
- `builtins.isBool` e
Return `true` if e evaluates to a bool, and `false` otherwise.
- `builtins.isBool` *e*
Return `true` if *e* evaluates to a bool, and `false` otherwise.
- `builtins.isPath` e
Return `true` if e evaluates to a path, and `false` otherwise.
- `builtins.isPath` *e*
Return `true` if *e* evaluates to a path, and `false` otherwise.
- `isNull` e; `builtins.isNull` e
Return `true` if e evaluates to `null`, and `false` otherwise.
- `isNull` *e*; `builtins.isNull` *e*
Return `true` if *e* evaluates to `null`, and `false` otherwise.
> **Warning**
>
> This function is *deprecated*; just write `e == null` instead.
- `builtins.length` e
Return the length of the list e.
- `builtins.length` *e*
Return the length of the list *e*.
- `builtins.lessThan` e1 e2
Return `true` if the number e1 is less than the number e2, and
`false` otherwise. Evaluation aborts if either e1 or e2 does not
- `builtins.lessThan` *e1* *e2*
Return `true` if the number *e1* is less than the number *e2*, and
`false` otherwise. Evaluation aborts if either *e1* or *e2* does not
evaluate to a number.
- `builtins.listToAttrs` e
- `builtins.listToAttrs` *e*
Construct a set from a list specifying the names and values of each
attribute. Each element of the list should be a set consisting of a
string-valued attribute `name` specifying the name of the attribute,
@ -451,19 +453,20 @@ For instance, `derivation` is also available as `builtins.derivation`.
{ foo = 123; bar = 456; }
- `map` f list; `builtins.map` f list
Apply the function f to each element in the list list. For example,
- `map` *f* *list*; `builtins.map` *f* *list*
Apply the function *f* to each element in the list *list*. For
example,
map (x: "foo" + x) [ "bar" "bla" "abc" ]
evaluates to `[ "foobar" "foobla" "fooabc"
]`.
- `builtins.match` regex str
- `builtins.match` *regex* *str*
Returns a list if the [extended POSIX regular
expression](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04)
regex matches str precisely, otherwise returns `null`. Each item in
the list is a regex group.
*regex* matches *str* precisely, otherwise returns `null`. Each item
in the list is a regex group.
builtins.match "ab" "abc"
@ -481,21 +484,21 @@ For instance, `derivation` is also available as `builtins.derivation`.
Evaluates to `[ "foo" ]`.
- `builtins.mul` e1 e2
Return the product of the numbers e1 and e2.
- `builtins.mul` *e1* *e2*
Return the product of the numbers *e1* and *e2*.
- `builtins.parseDrvName` s
Split the string s into a package name and version. The package name
is everything up to but not including the first dash followed by a
digit, and the version is everything following that dash. The result
is returned in a set `{ name, version }`. Thus,
- `builtins.parseDrvName` *s*
Split the string *s* into a package name and version. The package
name is everything up to but not including the first dash followed
by a digit, and the version is everything following that dash. The
result is returned in a set `{ name, version }`. Thus,
`builtins.parseDrvName "nix-0.12pre12876"` returns `{ name = "nix";
version = "0.12pre12876";
}`.
- `builtins.path` args
- `builtins.path` *args*
An enrichment of the built-in path type, based on the attributes
present in args. All are optional except `path`:
present in *args*. All are optional except `path`:
- path
The underlying path.
@ -523,20 +526,20 @@ For instance, `derivation` is also available as `builtins.derivation`.
providing a hash allows `builtins.path` to be used even when the
`pure-eval` nix config option is on.
- `builtins.pathExists` path
Return `true` if the path path exists at evaluation time, and
- `builtins.pathExists` *path*
Return `true` if the path *path* exists at evaluation time, and
`false` otherwise.
- `builtins.placeholder` output
Return a placeholder string for the specified output that will be
- `builtins.placeholder` *output*
Return a placeholder string for the specified *output* that will be
substituted by the corresponding output path at build time. Typical
outputs would be `"out"`, `"bin"` or `"dev"`.
- `builtins.readDir` path
Return the contents of the directory path as a set mapping directory
entries to the corresponding file type. For instance, if directory
`A` contains a regular file `B` and another directory `C`, then
`builtins.readDir
- `builtins.readDir` *path*
Return the contents of the directory *path* as a set mapping
directory entries to the corresponding file type. For instance, if
directory `A` contains a regular file `B` and another directory `C`,
then `builtins.readDir
./A` will return the set
{ B = "regular"; C = "directory"; }
@ -544,33 +547,33 @@ For instance, `derivation` is also available as `builtins.derivation`.
The possible values for the file type are `"regular"`,
`"directory"`, `"symlink"` and `"unknown"`.
- `builtins.readFile` path
Return the contents of the file path as a string.
- `builtins.readFile` *path*
Return the contents of the file *path* as a string.
- `removeAttrs` set list; `builtins.removeAttrs` set list
Remove the attributes listed in list from set. The attributes dont
have to exist in set. For instance,
- `removeAttrs` *set* *list*; `builtins.removeAttrs` *set* *list*
Remove the attributes listed in *list* from *set*. The attributes
dont have to exist in *set*. For instance,
removeAttrs { x = 1; y = 2; z = 3; } [ "a" "x" "z" ]
evaluates to `{ y = 2; }`.
- `builtins.replaceStrings` from to s
Given string s, replace every occurrence of the strings in from with
the corresponding string in to. For example,
- `builtins.replaceStrings` *from* *to* *s*
Given string *s*, replace every occurrence of the strings in *from*
with the corresponding string in *to*. For example,
builtins.replaceStrings ["oo" "a"] ["a" "i"] "foobar"
evaluates to `"fabir"`.
- `builtins.seq` e1 e2
Evaluate e1, then evaluate and return e2. This ensures that a
computation is strict in the value of e1.
- `builtins.seq` *e1* *e2*
Evaluate *e1*, then evaluate and return *e2*. This ensures that a
computation is strict in the value of *e1*.
- `builtins.sort` comparator list
Return list in sorted order. It repeatedly calls the function
comparator with two elements. The comparator should return `true` if
the first element is less than the second, and `false` otherwise.
- `builtins.sort` *comparator* *list*
Return *list* in sorted order. It repeatedly calls the function
*comparator* with two elements. The comparator should return `true`
if the first element is less than the second, and `false` otherwise.
For example,
builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ]
@ -581,12 +584,12 @@ For instance, `derivation` is also available as `builtins.derivation`.
This is a stable sort: it preserves the relative order of elements
deemed equal by the comparator.
- `builtins.split` regex str
- `builtins.split` *regex* *str*
Returns a list composed of non matched strings interleaved with the
lists of the [extended POSIX regular
expression](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04)
regex matches of str. Each item in the lists of matched sequences is
a regex group.
*regex* matches of *str*. Each item in the lists of matched
sequences is a regex group.
builtins.split "(a)b" "abc"
@ -604,44 +607,44 @@ For instance, `derivation` is also available as `builtins.derivation`.
Evaluates to `[ " " [ "FOO" ] " " ]`.
- `builtins.splitVersion` s
- `builtins.splitVersion` *s*
Split a string representing a version into its components, by the
same version splitting logic underlying the version comparison in
[`nix-env -u`](#ssec-version-comparisons).
- `builtins.stringLength` e
Return the length of the string e. If e is not a string, evaluation
is aborted.
- `builtins.stringLength` *e*
Return the length of the string *e*. If *e* is not a string,
evaluation is aborted.
- `builtins.sub` e1 e2
Return the difference between the numbers e1 and e2.
- `builtins.sub` *e1* *e2*
Return the difference between the numbers *e1* and *e2*.
- `builtins.substring` start len s
Return the substring of s from character position start (zero-based)
up to but not including start + len. If start is greater than the
length of the string, an empty string is returned, and if start +
len lies beyond the end of the string, only the substring up to the
end of the string is returned. start must be non-negative. For
example,
- `builtins.substring` *start* *len* *s*
Return the substring of *s* from character position *start*
(zero-based) up to but not including *start + len*. If *start* is
greater than the length of the string, an empty string is returned,
and if *start + len* lies beyond the end of the string, only the
substring up to the end of the string is returned. *start* must be
non-negative. For example,
builtins.substring 0 3 "nixos"
evaluates to `"nix"`.
- `builtins.tail` list
- `builtins.tail` *list*
Return the second to last elements of a list; abort evaluation if
the argument isnt a list or is an empty list.
- `throw` s; `builtins.throw` s
Throw an error message s. This usually aborts Nix expression
- `throw` *s*; `builtins.throw` *s*
Throw an error message *s*. This usually aborts Nix expression
evaluation, but in `nix-env -qa` and other commands that try to
evaluate a set of derivations to get information about those
derivations, a derivation that throws an error is silently skipped
(which is not the case for `abort`).
- `builtins.toFile` name s
Store the string s in a file in the Nix store and return its path.
The file has suffix name. This file can be used as an input to
- `builtins.toFile` *name* *s*
Store the string *s* in a file in the Nix store and return its path.
The file has suffix *name*. This file can be used as an input to
derivations. One application is to write builders “inline”. For
instance, the following Nix expression combines [???](#ex-hello-nix)
and [???](#ex-hello-builder) into one file:
@ -705,20 +708,20 @@ For instance, `derivation` is also available as `builtins.derivation`.
you are using Nixpkgs, the `writeTextFile` function is able to do
that.
- `builtins.toJSON` e
Return a string containing a JSON representation of e. Strings,
- `builtins.toJSON` *e*
Return a string containing a JSON representation of *e*. Strings,
integers, floats, booleans, nulls and lists are mapped to their JSON
equivalents. Sets (except derivations) are represented as objects.
Derivations are translated to a JSON string containing the
derivations output path. Paths are copied to the store and
represented as a JSON string of the resulting store path.
- `builtins.toPath` s
- `builtins.toPath` *s*
DEPRECATED. Use `/. + "/path"` to convert a string into an absolute
path. For relative paths, use `./. + "/path"`.
- `toString` e; `builtins.toString` e
Convert the expression e to a string. e can be:
- `toString` *e*; `builtins.toString` *e*
Convert the expression *e* to a string. *e* can be:
- A string (in which case the string is returned unmodified).
@ -735,8 +738,8 @@ For instance, `derivation` is also available as `builtins.derivation`.
- `null`, which yields the empty string.
- `builtins.toXML` e
Return a string containing an XML representation of e. The main
- `builtins.toXML` *e*
Return a string containing an XML representation of *e*. The main
application for `toXML` is to communicate information with the
builder in a more structured format than plain environment
variables.
@ -822,22 +825,23 @@ For instance, `derivation` is also available as `builtins.derivation`.
of the stylesheet is spliced into the builder using the syntax
`xsltproc ${stylesheet}`.
- `builtins.trace` e1 e2
Evaluate e1 and print its abstract syntax representation on standard
error. Then return e2. This function is useful for debugging.
- `builtins.trace` *e1* *e2*
Evaluate *e1* and print its abstract syntax representation on
standard error. Then return *e2*. This function is useful for
debugging.
- `builtins.tryEval` e
Try to shallowly evaluate e. Return a set containing the attributes
`success` (`true` if e evaluated successfully, `false` if an error
was thrown) and `value`, equalling e if successful and `false`
otherwise. Note that this doesn't evaluate e deeply, so ` let e = {
x = throw ""; }; in (builtins.tryEval e).success
- `builtins.tryEval` *e*
Try to shallowly evaluate *e*. Return a set containing the
attributes `success` (`true` if *e* evaluated successfully, `false`
if an error was thrown) and `value`, equalling *e* if successful and
`false` otherwise. Note that this doesn't evaluate *e* deeply, so
` let e = { x = throw ""; }; in (builtins.tryEval e).success
` will be `true`. Using ` builtins.deepSeq
` one can get the expected result: `let e = { x = throw "";
}; in (builtins.tryEval (builtins.deepSeq e e)).success` will be
`false`.
- `builtins.typeOf` e
Return a string representing the type of the value e, namely
- `builtins.typeOf` *e*
Return a string representing the type of the value *e*, namely
`"int"`, `"bool"`, `"string"`, `"path"`, `"null"`, `"set"`,
`"list"`, `"lambda"` or `"float"`.

View file

@ -33,7 +33,7 @@ elements (referenced from the figure by number):
Nix functions generally have the form `{ x, y, ...,
z }: e` where `x`, `y`, etc. are the names of the expected
arguments, and where e is the body of the function. So here, the
arguments, and where *e* is the body of the function. So here, the
entire remainder of the file is the body of the function; when given
the required arguments, the body should describe how to build an
instance of the Hello package.

View file

@ -147,7 +147,7 @@ three kinds of patterns:
It is possible to provide *default values* for attributes, in which
case they are allowed to be missing. A default value is specified by
writing `name ?
e`, where e is an arbitrary expression. For example,
e`, where *e* is an arbitrary expression. For example,
{ x, y ? "foo", z ? "bar" }: z + y + x
@ -201,7 +201,7 @@ Conditionals look like this:
if e1 then e2 else e3
where e1 is an expression that should evaluate to a Boolean value
where *e1* is an expression that should evaluate to a Boolean value
(`true` or `false`).
## Assertions
@ -211,9 +211,9 @@ between features and dependencies hold. They look like this:
assert e1; e2
where e1 is an expression that should evaluate to a Boolean value. If it
evaluates to `true`, e2 is returned; otherwise expression evaluation is
aborted and a backtrace is printed.
where *e1* is an expression that should evaluate to a Boolean value. If
it evaluates to `true`, *e2* is returned; otherwise expression
evaluation is aborted and a backtrace is printed.
Here is a Nix expression for the Subversion package that shows how
assertions can be used:.
@ -275,8 +275,8 @@ A *with-expression*,
with e1; e2
introduces the set e1 into the lexical scope of the expression e2. For
instance,
introduces the set *e1* into the lexical scope of the expression *e2*.
For instance,
let as = { x = "foo"; y = "bar"; };
in with as; x + y

View file

@ -4,29 +4,29 @@
expression language, in order of precedence (from strongest to weakest
binding).
| Name | Syntax | Associativity | Description | Precedence |
| ------------------------ | ----------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| Select | e `.` attrpath \[ `or` def \] | none | Select attribute denoted by the attribute path attrpath from set e. (An attribute path is a dot-separated list of attribute names.) If the attribute doesnt exist, return def if provided, otherwise abort evaluation. | 1 |
| Application | e1 e2 | left | Call function e1 with argument e2. | 2 |
| Arithmetic Negation | `-` e | none | Arithmetic negation. | 3 |
| Has Attribute | e `?` attrpath | none | Test whether set e contains the attribute denoted by attrpath; return `true` or `false`. | 4 |
| List Concatenation | e1 `++` e2 | right | List concatenation. | 5 |
| Multiplication | e1 `*` e2, | left | Arithmetic multiplication. | 6 |
| Division | e1 `/` e2 | left | Arithmetic division. | 6 |
| Addition | e1 `+` e2 | left | Arithmetic addition. | 7 |
| Subtraction | e1 `-` e2 | left | Arithmetic subtraction. | 7 |
| String Concatenation | string1 `+` string2 | left | String concatenation. | 7 |
| Not | `!` e | none | Boolean negation. | 8 |
| Update | e1 `//` e2 | right | Return a set consisting of the attributes in e1 and e2 (with the latter taking precedence over the former in case of equally named attributes). | 9 |
| Less Than | e1 `<` e2, | none | Arithmetic comparison. | 10 |
| Less Than or Equal To | e1 `<=` e2 | none | Arithmetic comparison. | 10 |
| Greater Than | e1 `>` e2 | none | Arithmetic comparison. | 10 |
| Greater Than or Equal To | e1 `>=` e2 | none | Arithmetic comparison. | 10 |
| Equality | e1 `==` e2 | none | Equality. | 11 |
| Inequality | e1 `!=` e2 | none | Inequality. | 11 |
| Logical AND | e1 `&&` e2 | left | Logical AND. | 12 |
| Logical OR | e1 `\|\|` e2 | left | Logical OR. | 13 |
| Logical Implication | e1 `->` e2 | none | Logical implication (equivalent to `!e1 \|\|
e2`). | 14 |
| Name | Syntax | Associativity | Description | Precedence |
| ------------------------ | ----------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| Select | *e* `.` *attrpath* \[ `or` *def* \] | none | Select attribute denoted by the attribute path *attrpath* from set *e*. (An attribute path is a dot-separated list of attribute names.) If the attribute doesnt exist, return *def* if provided, otherwise abort evaluation. | 1 |
| Application | *e1* *e2* | left | Call function *e1* with argument *e2*. | 2 |
| Arithmetic Negation | `-` *e* | none | Arithmetic negation. | 3 |
| Has Attribute | *e* `?` *attrpath* | none | Test whether set *e* contains the attribute denoted by *attrpath*; return `true` or `false`. | 4 |
| List Concatenation | *e1* `++` *e2* | right | List concatenation. | 5 |
| Multiplication | *e1* `*` *e2*, | left | Arithmetic multiplication. | 6 |
| Division | *e1* `/` *e2* | left | Arithmetic division. | 6 |
| Addition | *e1* `+` *e2* | left | Arithmetic addition. | 7 |
| Subtraction | *e1* `-` *e2* | left | Arithmetic subtraction. | 7 |
| String Concatenation | *string1* `+` *string2* | left | String concatenation. | 7 |
| Not | `!` *e* | none | Boolean negation. | 8 |
| Update | *e1* `//` *e2* | right | Return a set consisting of the attributes in *e1* and *e2* (with the latter taking precedence over the former in case of equally named attributes). | 9 |
| Less Than | *e1* `<` *e2*, | none | Arithmetic comparison. | 10 |
| Less Than or Equal To | *e1* `<=` *e2* | none | Arithmetic comparison. | 10 |
| Greater Than | *e1* `>` *e2* | none | Arithmetic comparison. | 10 |
| Greater Than or Equal To | *e1* `>=` *e2* | none | Arithmetic comparison. | 10 |
| Equality | *e1* `==` *e2* | none | Equality. | 11 |
| Inequality | *e1* `!=` *e2* | none | Inequality. | 11 |
| Logical AND | *e1* `&&` *e2* | left | Logical AND. | 12 |
| Logical OR | *e1* `\|\|` *e2* | left | Logical OR. | 13 |
| Logical Implication | *e1* `->` *e2* | none | Logical implication (equivalent to `!e1 \|\|
e2`). | 14 |
Operators

View file

@ -17,7 +17,7 @@ command:
The installation path can be specified by passing the `--prefix=prefix`
to `configure`. The default installation directory is `/usr/local`. You
can change this to any location you like. You must have write permission
to the prefix path.
to the *prefix* path.
Nix keeps its *store* (the place where packages are stored) in
`/nix/store` by default. This can be changed using

View file

@ -60,7 +60,8 @@ Nixpkgs tree using the `-f` flag:
$ nix-env -qaf /path/to/nixpkgs
where /path/to/nixpkgs is where youve unpacked or checked out Nixpkgs.
where */path/to/nixpkgs* is where youve unpacked or checked out
Nixpkgs.
You can select specific packages by name:

View file

@ -34,7 +34,7 @@
- `nix-env -i
pkgname` will now install the highest available version of
pkgname, rather than installing all available versions (which
*pkgname*, rather than installing all available versions (which
would probably give collisions) (`NIX-31`).
- `nix-env (-i|-u) --dry-run` now shows exactly which missing

View file

@ -41,10 +41,10 @@
- The garbage collector has a number of new options to allow only some
of the garbage to be deleted. The option `--max-freed N` tells the
collector to stop after at least N bytes have been deleted. The
collector to stop after at least *N* bytes have been deleted. The
option `--max-links
N` tells it to stop after the link count on `/nix/store` has dropped
below N. This is useful for very large Nix stores on filesystems
below *N*. This is useful for very large Nix stores on filesystems
with a 32000 subdirectories limit (like `ext3`). The option
`--use-atime` causes store paths to be deleted in order of ascending
last access time. This allows non-recently used stuff to be deleted.

View file

@ -51,5 +51,5 @@ This is primarily a bug fix release. It has some new features:
option is used.
- The scoping rules for `inherit
(e) ...` in recursive attribute sets have changed. The expression e
can now refer to the attributes defined in the containing set.
(e) ...` in recursive attribute sets have changed. The expression
*e* can now refer to the attributes defined in the containing set.

View file

@ -15,7 +15,7 @@ This release has the following improvements:
`--cores
N` as well as a configuration setting `build-cores =
N` that causes the environment variable `NIX_BUILD_CORES` to be set
to N when the builder is invoked. The builder can use this at its
to *N* when the builder is invoked. The builder can use this at its
discretion to perform a parallel build, e.g., by calling `make -j
N`. In Nixpkgs, this can be enabled on a per-package basis by
setting the derivation attribute `enableParallelBuilding` to `true`.

View file

@ -49,8 +49,8 @@
- New language construct: `with
E1;
E2` brings all attributes defined in the attribute set E1 in
scope in E2.
E2` brings all attributes defined in the attribute set *E1* in
scope in *E2*.
- Added a `map` function.

View file

@ -35,7 +35,7 @@ features:
derivations, and in `builtins.hashString`.
- The new flag `--option build-repeat
N` will cause every build to be executed N+1 times. If the build
N` will cause every build to be executed *N*+1 times. If the build
output differs between any round, the build is rejected, and the
output paths are not registered as valid. This is primarily useful
to verify build determinism. (We already had a `--check` option to

View file

@ -10,7 +10,7 @@ There are also the following improvements:
- New built-in function: `builtins.hashString`.
- Build logs are now stored in `/nix/var/log/nix/drvs/XX/`, where XX
- Build logs are now stored in `/nix/var/log/nix/drvs/XX/`, where *XX*
is the first two characters of the derivation. This is useful on
machines that keep a lot of build logs (such as Hydra servers).

View file

@ -6,8 +6,8 @@ This is primarily a bug fix release. Changes of interest are:
strings, such as `"${/foo}/bar"`. This release reverts to the Nix
1.5.3 behaviour.
- Previously, Nix optimised expressions such as `"${expr}"` to expr.
Thus it neither checked whether expr could be coerced to a string,
- Previously, Nix optimised expressions such as `"${expr}"` to *expr*.
Thus it neither checked whether *expr* could be coerced to a string,
nor applied such coercions. This meant that `"${123}"` evaluatued to
`123`, and `"${./foo}"` evaluated to `./foo` (even though `"${./foo}
"` evaluates to `"/nix/store/hash-foo "`). Nix now checks the type

View file

@ -89,10 +89,10 @@ features:
specifier. For example, `nix-store --gc --max-freed
1G` will free up to 1 gigabyte of disk space.
- `nix-collect-garbage` has a new flag `--delete-older-than` N`d`,
which deletes all user environment generations older than N days.
- `nix-collect-garbage` has a new flag `--delete-older-than` *N*`d`,
which deletes all user environment generations older than *N* days.
Likewise, `nix-env
--delete-generations` accepts a N`d` age limit.
--delete-generations` accepts a *N*`d` age limit.
- Nix now heuristically detects whether a build failure was due to a
disk-full condition. In that case, the build is not flagged as