mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 09:06:15 +02:00
clarify definition of "installable"
the term was hard to discover, as its definition and explanation were in a very long document lacking an overview section. search did not help because it occurs so often. - clarify wording in the definition - add an overview of installable types - add "installable" to glossary - link to definition from occurrences of the term - be more precise about where store derivation outputs are processed - installable Nix expressions must evaluate to a derivation Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
This commit is contained in:
parent
1e87d5f1ea
commit
2af9fd20c6
22 changed files with 61 additions and 51 deletions
|
@ -193,6 +193,11 @@
|
||||||
A symlink to the current *user environment* of a user, e.g.,
|
A symlink to the current *user environment* of a user, e.g.,
|
||||||
`/nix/var/nix/profiles/default`.
|
`/nix/var/nix/profiles/default`.
|
||||||
|
|
||||||
|
- [installable]{#gloss-installable}\
|
||||||
|
Something that can be realised in the Nix store.
|
||||||
|
|
||||||
|
See [installables](./command-ref/new-cli/nix.md#installables) for [`nix` commands](./command-ref/new-cli/nix.md) (experimental) for details.
|
||||||
|
|
||||||
- [NAR]{#gloss-nar}\
|
- [NAR]{#gloss-nar}\
|
||||||
A *N*ix *AR*chive. This is a serialisation of a path in the Nix
|
A *N*ix *AR*chive. This is a serialisation of a path in the Nix
|
||||||
store. It can contain regular files, directories and symbolic
|
store. It can contain regular files, directories and symbolic
|
||||||
|
|
|
@ -22,7 +22,7 @@ static constexpr Command::Category catSecondary = 100;
|
||||||
static constexpr Command::Category catUtility = 101;
|
static constexpr Command::Category catUtility = 101;
|
||||||
static constexpr Command::Category catNixInstallation = 102;
|
static constexpr Command::Category catNixInstallation = 102;
|
||||||
|
|
||||||
static constexpr auto installablesCategory = "Options that change the interpretation of installables";
|
static constexpr auto installablesCategory = "Options that change the interpretation of [installables](@docroot@/command-ref/new-cli/nix.md#installables)";
|
||||||
|
|
||||||
struct NixMultiCommand : virtual MultiCommand, virtual Command
|
struct NixMultiCommand : virtual MultiCommand, virtual Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,7 +153,7 @@ SourceExprCommand::SourceExprCommand()
|
||||||
.longName = "file",
|
.longName = "file",
|
||||||
.shortName = 'f',
|
.shortName = 'f',
|
||||||
.description =
|
.description =
|
||||||
"Interpret installables as attribute paths relative to the Nix expression stored in *file*. "
|
"Interpret [*installables*](@docroot@/command-ref/new-cli/nix.md#installables) as attribute paths relative to the Nix expression stored in *file*. "
|
||||||
"If *file* is the character -, then a Nix expression will be read from standard input. "
|
"If *file* is the character -, then a Nix expression will be read from standard input. "
|
||||||
"Implies `--impure`.",
|
"Implies `--impure`.",
|
||||||
.category = installablesCategory,
|
.category = installablesCategory,
|
||||||
|
@ -164,7 +164,7 @@ SourceExprCommand::SourceExprCommand()
|
||||||
|
|
||||||
addFlag({
|
addFlag({
|
||||||
.longName = "expr",
|
.longName = "expr",
|
||||||
.description = "Interpret installables as attribute paths relative to the Nix expression *expr*.",
|
.description = "Interpret [*installables*](@docroot@/command-ref/new-cli/nix.md#installables) as attribute paths relative to the Nix expression *expr*.",
|
||||||
.category = installablesCategory,
|
.category = installablesCategory,
|
||||||
.labels = {"expr"},
|
.labels = {"expr"},
|
||||||
.handler = {&expr}
|
.handler = {&expr}
|
||||||
|
|
|
@ -82,7 +82,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix build` builds the specified *installables*. Installables that
|
`nix build` builds the specified *installables*. [Installables](./nix.md#installables) that
|
||||||
resolve to derivations are built (or substituted if possible). Store
|
resolve to derivations are built (or substituted if possible). Store
|
||||||
path installables are substituted.
|
path installables are substituted.
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix bundle`, by default, packs the closure of the *installable* into a single
|
`nix bundle`, by default, packs the closure of the [*installable*](./nix.md#installables) into a single
|
||||||
self-extracting executable. See the [`bundlers`
|
self-extracting executable. See the [`bundlers`
|
||||||
homepage](https://github.com/NixOS/bundlers) for more details.
|
homepage](https://github.com/NixOS/bundlers) for more details.
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ R""(
|
||||||
|
|
||||||
`nix develop` starts a `bash` shell that provides an interactive build
|
`nix develop` starts a `bash` shell that provides an interactive build
|
||||||
environment nearly identical to what Nix would use to build
|
environment nearly identical to what Nix would use to build
|
||||||
*installable*. Inside this shell, environment variables and shell
|
[*installable*](./nix.md#installables). Inside this shell, environment variables and shell
|
||||||
functions are set up so that you can interactively and incrementally
|
functions are set up so that you can interactively and incrementally
|
||||||
build your package.
|
build your package.
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command evaluates the Nix expression *installable* and prints the
|
This command evaluates the given Nix expression and prints the
|
||||||
result on standard output.
|
result on standard output.
|
||||||
|
|
||||||
# Output format
|
# Output format
|
||||||
|
|
|
@ -275,8 +275,8 @@ Currently the `type` attribute can be one of the following:
|
||||||
# Flake format
|
# Flake format
|
||||||
|
|
||||||
As an example, here is a simple `flake.nix` that depends on the
|
As an example, here is a simple `flake.nix` that depends on the
|
||||||
Nixpkgs flake and provides a single package (i.e. an installable
|
Nixpkgs flake and provides a single package (i.e. an
|
||||||
derivation):
|
[installable](./nix.md#installables) derivation):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,8 +22,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command prints the log of a previous build of the derivation
|
This command prints the log of a previous build of the [*installable*](./nix.md#installables) on standard output.
|
||||||
*installable* on standard output.
|
|
||||||
|
|
||||||
Nix looks for build logs in two places:
|
Nix looks for build logs in two places:
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,9 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command converts the closure of the store paths specified by
|
This command converts the closure of the store paths specified by
|
||||||
*installables* to content-addressed form. Nix store paths are usually
|
[*installables*](./nix.md#installables) to content-addressed form.
|
||||||
|
|
||||||
|
Nix store paths are usually
|
||||||
*input-addressed*, meaning that the hash part of the store path is
|
*input-addressed*, meaning that the hash part of the store path is
|
||||||
computed from the contents of the derivation (i.e., the build-time
|
computed from the contents of the derivation (i.e., the build-time
|
||||||
dependency graph). Input-addressed paths need to be signed by a
|
dependency graph). Input-addressed paths need to be signed by a
|
||||||
|
|
|
@ -48,22 +48,26 @@ manual](https://nixos.org/manual/nix/stable/).
|
||||||
|
|
||||||
# Installables
|
# Installables
|
||||||
|
|
||||||
Many `nix` subcommands operate on one or more *installables*. These are
|
Many `nix` subcommands operate on one or more *installables*.
|
||||||
command line arguments that represent something that can be built in
|
These are command line arguments that represent something that can be realised in the Nix store.
|
||||||
the Nix store.
|
|
||||||
|
|
||||||
For most commands, if no installable is specified, the default is `.`,
|
The following types of installable are supported by most commands:
|
||||||
i.e. Nix will operate on the default flake output attribute of the
|
|
||||||
flake in the current directory.
|
|
||||||
|
|
||||||
Here are the recognised types of installables:
|
- [Flake output attribute](#flake-output-attribute)
|
||||||
|
- [Store path](#store-path)
|
||||||
|
- [Store derivation](#store-derivation)
|
||||||
|
- [Nix file](#nix-file), optionally qualified by an attribute path
|
||||||
|
- [Nix expression](#nix-expression), optionally qualified by an attribute path
|
||||||
|
|
||||||
## Flake output attributes
|
For most commands, if no installable is specified, `.` as assumed.
|
||||||
|
That is, Nix will operate on the default flake output attribute of the flake in the current directory.
|
||||||
|
|
||||||
|
### Flake output attribute
|
||||||
|
|
||||||
Example: `nixpkgs#hello`
|
Example: `nixpkgs#hello`
|
||||||
|
|
||||||
These have the form *flakeref*[`#`*attrpath*], where *flakeref* is a
|
These have the form *flakeref*[`#`*attrpath*], where *flakeref* is a
|
||||||
flake reference and *attrpath* is an optional attribute path. For
|
[flake reference](./nix3-flake.md#flake-references) and *attrpath* is an optional attribute path. For
|
||||||
more information on flakes, see [the `nix flake` manual
|
more information on flakes, see [the `nix flake` manual
|
||||||
page](./nix3-flake.md). Flake references are most commonly a flake
|
page](./nix3-flake.md). Flake references are most commonly a flake
|
||||||
identifier in the flake registry (e.g. `nixpkgs`), or a raw path
|
identifier in the flake registry (e.g. `nixpkgs`), or a raw path
|
||||||
|
@ -116,46 +120,46 @@ subcommands, these are `packages.`*system*,
|
||||||
attributes `packages.x86_64-linux.hello`,
|
attributes `packages.x86_64-linux.hello`,
|
||||||
`legacyPackages.x86_64-linux.hello` and `hello`.
|
`legacyPackages.x86_64-linux.hello` and `hello`.
|
||||||
|
|
||||||
## Store paths
|
### Store path
|
||||||
|
|
||||||
Example: `/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10`
|
Example: `/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10`
|
||||||
|
|
||||||
These are paths inside the Nix store, or symlinks that resolve to a
|
These are paths inside the Nix store, or symlinks that resolve to a path in the Nix store.
|
||||||
path in the Nix store.
|
|
||||||
|
|
||||||
## Store derivations
|
### Store derivation
|
||||||
|
|
||||||
Example: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv`
|
Example: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv`
|
||||||
|
|
||||||
By default, if you pass a [store derivation] path to a `nix` subcommand, the command will operate on the [output path]s of the derivation.
|
By default, if you pass a [store derivation] path to a `nix` subcommand other than [`show-derivation`](./nix3-show-derivation.md), the command will operate on the [output path]s of the derivation.
|
||||||
|
|
||||||
[output path]: ../../glossary.md#gloss-output-path
|
[output path]: ../../glossary.md#gloss-output-path
|
||||||
|
|
||||||
For example, `nix path-info` prints information about the output paths:
|
For example, [`nix path-info`](./nix3-path-info.md) prints information about the output paths:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# nix path-info --json /nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv
|
# nix path-info --json /nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv
|
||||||
[{"path":"/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10",…}]
|
[{"path":"/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10",…}]
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to operate on the store derivation itself, pass the
|
If you want to operate on the store derivation itself, pass the `--derivation` flag.
|
||||||
`--derivation` flag.
|
|
||||||
|
|
||||||
## Nix attributes
|
### Nix file
|
||||||
|
|
||||||
Example: `--file /path/to/nixpkgs hello`
|
Example: `--file /path/to/nixpkgs hello`
|
||||||
|
|
||||||
When the `-f` / `--file` *path* option is given, installables are
|
When the option `-f` / `--file` *path* \[*attrpath*...\] is given, installables are interpreted as the value of the expression in the Nix file at *path*.
|
||||||
interpreted as attribute paths referencing a value returned by
|
If attribute paths are provided, commands will operate on the corresponding values accessible at these paths.
|
||||||
evaluating the Nix file *path*.
|
The Nix expression in that file, or any selected attribute, must evaluate to a derivation.
|
||||||
|
|
||||||
## Nix expressions
|
### Nix expression
|
||||||
|
|
||||||
Example: `--expr '(import <nixpkgs> {}).hello.overrideDerivation (prev: { name = "my-hello"; })'`.
|
Example: `--expr 'import <nixpkgs> {}' hello`
|
||||||
|
|
||||||
When the `--expr` option is given, all installables are interpreted
|
When the option `--expr` *expression* \[*attrpath*...\] is given, installables are interpreted as the value of the of the Nix expression.
|
||||||
as Nix expressions. You may need to specify `--impure` if the
|
If attribute paths are provided, commands will operate on the corresponding values accessible at these paths.
|
||||||
expression references impure inputs (such as `<nixpkgs>`).
|
The Nix expression, or any selected attribute, must evaluate to a derivation.
|
||||||
|
|
||||||
|
You may need to specify `--impure` if the expression references impure inputs (such as `<nixpkgs>`).
|
||||||
|
|
||||||
## Derivation output selection
|
## Derivation output selection
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command shows information about the store paths produced by
|
This command shows information about the store paths produced by
|
||||||
*installables*, or about all paths in the store if you pass `--all`.
|
[*installables*](./nix.md#installables), or about all paths in the store if you pass `--all`.
|
||||||
|
|
||||||
By default, this command only prints the store paths. You can get
|
By default, this command only prints the store paths. You can get
|
||||||
additional information by passing flags such as `--closure-size`,
|
additional information by passing flags such as `--closure-size`,
|
||||||
|
|
|
@ -40,7 +40,7 @@ R""(
|
||||||
|
|
||||||
This command prints a shell script that can be sourced by `bash` and
|
This command prints a shell script that can be sourced by `bash` and
|
||||||
that sets the variables and shell functions defined by the build
|
that sets the variables and shell functions defined by the build
|
||||||
process of *installable*. This allows you to get a similar build
|
process of [*installable*](./nix.md#installables). This allows you to get a similar build
|
||||||
environment in your current shell rather than in a subshell (as with
|
environment in your current shell rather than in a subshell (as with
|
||||||
`nix develop`).
|
`nix develop`).
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,6 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command adds *installables* to a Nix profile.
|
This command adds [*installables*](./nix.md#installables) to a Nix profile.
|
||||||
|
|
||||||
)""
|
)""
|
||||||
|
|
|
@ -35,7 +35,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix run` builds and runs *installable*, which must evaluate to an
|
`nix run` builds and runs [*installable*](./nix.md#installables), which must evaluate to an
|
||||||
*app* or a regular Nix derivation.
|
*app* or a regular Nix derivation.
|
||||||
|
|
||||||
If *installable* evaluates to an *app* (see below), it executes the
|
If *installable* evaluates to an *app* (see below), it executes the
|
||||||
|
|
|
@ -62,10 +62,10 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix search` searches *installable* (which must be evaluatable, e.g. a
|
`nix search` searches [*installable*](./nix.md#installables) (which can be evaluated, that is, a
|
||||||
flake) for packages whose name or description matches all of the
|
flake or Nix expression, but not a store path or store derivation path) for packages whose name or description matches all of the
|
||||||
regular expressions *regex*. For each matching package, It prints the
|
regular expressions *regex*. For each matching package, It prints the
|
||||||
full attribute name (from the root of the installable), the version
|
full attribute name (from the root of the [installable](./nix.md#installables)), the version
|
||||||
and the `meta.description` field, highlighting the substrings that
|
and the `meta.description` field, highlighting the substrings that
|
||||||
were matched by the regular expressions. If no regular expressions are
|
were matched by the regular expressions. If no regular expressions are
|
||||||
specified, all packages are shown.
|
specified, all packages are shown.
|
||||||
|
|
|
@ -48,7 +48,7 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix shell` runs a command in an environment in which the `$PATH` variable
|
`nix shell` runs a command in an environment in which the `$PATH` variable
|
||||||
provides the specified *installables*. If no command is specified, it starts the
|
provides the specified [*installables*](./nix.md#installable). If no command is specified, it starts the
|
||||||
default shell of your user account specified by `$SHELL`.
|
default shell of your user account specified by `$SHELL`.
|
||||||
|
|
||||||
)""
|
)""
|
||||||
|
|
|
@ -39,7 +39,7 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command prints on standard output a JSON representation of the
|
This command prints on standard output a JSON representation of the
|
||||||
[store derivation]s to which *installables* evaluate. Store derivations
|
[store derivation]s to which [*installables*](./nix.md#installables) evaluate. Store derivations
|
||||||
are used internally by Nix. They are store paths with extension `.drv`
|
are used internally by Nix. They are store paths with extension `.drv`
|
||||||
that represent the build-time dependency graph to which a Nix
|
that represent the build-time dependency graph to which a Nix
|
||||||
expression evaluates.
|
expression evaluates.
|
||||||
|
|
|
@ -10,7 +10,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command deletes the store paths specified by *installables*. ,
|
This command deletes the store paths specified by [*installables*](./nix.md#installables),
|
||||||
but only if it is safe to do so; that is, when the path is not
|
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
|
reachable from a root of the garbage collector. This means that you
|
||||||
can only delete paths that would also be deleted by `nix store
|
can only delete paths that would also be deleted by `nix store
|
||||||
|
|
|
@ -18,6 +18,6 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command generates a NAR file containing the serialisation of the
|
This command generates a NAR file containing the serialisation of the
|
||||||
store path *installable*. The NAR is written to standard output.
|
store path [*installable*](./nix.md#installables). The NAR is written to standard output.
|
||||||
|
|
||||||
)""
|
)""
|
||||||
|
|
|
@ -17,7 +17,7 @@ R""(
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command attempts to "repair" the store paths specified by
|
This command attempts to "repair" the store paths specified by
|
||||||
*installables* by redownloading them using the available
|
[*installables*](./nix.md#installables) by redownloading them using the available
|
||||||
substituters. If no substitutes are available, then repair is not
|
substituters. If no substitutes are available, then repair is not
|
||||||
possible.
|
possible.
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command verifies the integrity of the store paths *installables*,
|
This command verifies the integrity of the store paths [*installables*](./nix.md#installables),
|
||||||
or, if `--all` is given, the entire Nix store. For each path, it
|
or, if `--all` is given, the entire Nix store. For each path, it
|
||||||
checks that
|
checks that
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue