1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 12:41:00 +01:00

WIP document derivations and deriving paths

And get rid of "store derivation" nonsense.
This commit is contained in:
John Ericson 2023-11-16 11:04:19 -05:00
parent 7ebeceaf3d
commit a654cc2a72
31 changed files with 359 additions and 186 deletions

View file

@ -144,7 +144,7 @@ MixOperateOnOptions::MixOperateOnOptions()
addFlag({
.longName = "derivation",
.description =
"Operate on the [store derivation](@docroot@/glossary.md#gloss-store-derivation) rather than its outputs.",
"Operate on the [derivation](@docroot@/glossary.md#gloss-derivation) rather than its outputs.",
.category = installablesCategory,
.handler = {&operateOn, OperateOn::Derivation},
});

View file

@ -24,7 +24,7 @@ enum class Realise {
/**
* Don't build the derivation.
*
* Postcondition: the store derivation exists.
* Postcondition: the derivation exists.
*/
Derivation,
/**

View file

@ -777,7 +777,7 @@ StorePath AttrCursor::forceDerivation()
been garbage-collected. So force it to be regenerated. */
aDrvPath->forceValue();
if (!root->state.store->isValidPath(drvPath))
throw Error("don't know how to recreate store derivation '%s'!",
throw Error("don't know how to recreate derivation '%s'!",
root->state.store->printStorePath(drvPath));
}
return drvPath;

View file

@ -1505,7 +1505,7 @@ static void derivationStrictInternal(
}
else {
/* Compute a hash over the "masked" store derivation, which is
/* Compute a hash over the "masked" derivation, which is
the final one except that in the list of outputs, the
output paths are empty strings, and the corresponding
environment variables have an empty value. This ensures
@ -1551,7 +1551,7 @@ static void derivationStrictInternal(
printMsg(lvlChatty, "instantiated '%1%' -> '%2%'", drvName, drvPathS);
/* Optimisation, but required in read-only mode! because in that
case we don't actually write store derivations, so we can't
case we don't actually write derivations, so we can't
read them later. */
{
auto h = hashDerivationModulo(*state.store, drv, false);

View file

@ -236,7 +236,7 @@ static RegisterPrimOp primop_getContext({
Return the string context of *s*.
The string context tracks references to derivations within a string.
It is represented as an attribute set of [store derivation](@docroot@/glossary.md#gloss-store-derivation) paths mapping to output names.
It is represented as an attribute set of [derivation](@docroot@/glossary.md#gloss-derivation) paths mapping to output names.
Using [string interpolation](@docroot@/language/string-interpolation.md) on a derivation will add that derivation to the string context.
For example,

View file

@ -14,7 +14,7 @@ struct CmdAddDerivation : MixDryRun, StoreCommand
{
std::string description() override
{
return "Add a store derivation";
return "Add a derivation";
}
std::string doc() override

View file

@ -3,17 +3,16 @@ R""(
# Description
This command reads from standard input a JSON representation of a
[store derivation].
[derivation].
Store derivations are used internally by Nix. They are store paths with
extension `.drv` that represent the build-time dependency graph to which
a Nix expression evaluates.
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: @docroot@/glossary.md#gloss-derivation
`nix derivation add` takes a single derivation in the following format:
{{#include ../../protocols/json/derivation.md}}
{{#include @docroot@/protocols/json/derivation.md}}
)""

View file

@ -1,5 +1,4 @@
// FIXME: integrate this with nix path-info?
// FIXME: rename to 'nix store derivation show' or 'nix debug derivation show'?
// FIXME: integrate this with `nix path-info`?
#include "command.hh"
#include "common-args.hh"
@ -27,7 +26,7 @@ struct CmdShowDerivation : InstallablesCommand
std::string description() override
{
return "show the contents of a store derivation";
return "show the contents of a derivation";
}
std::string doc() override

View file

@ -2,7 +2,7 @@ R""(
# Examples
* Show the [store derivation] that results from evaluating the Hello
* Show the [derivation] that results from evaluating the Hello
package:
```console
@ -37,7 +37,7 @@ R""(
# Description
This command prints on standard output a JSON representation of the
[store derivation]s to which [*installables*](./nix.md#installables) evaluate.
[derivation]s to which [*installables*](./nix.md#installables) evaluate.
Store derivations are used internally by Nix. They are store paths with
extension `.drv` that represent the build-time dependency graph to which
@ -46,7 +46,7 @@ a Nix expression evaluates.
By default, this command only shows top-level derivations, but with
`--recursive`, it also shows their dependencies.
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: ../../glossary.md#gloss-derivation
`nix derivation show` outputs a JSON map of [store path]s to derivations in the following format:

View file

@ -144,11 +144,11 @@ Example: `/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10`
These are paths inside the Nix store, or symlinks that resolve to a path in the Nix store.
A [store derivation] is also addressed by store path.
A [derivation] is also addressed by store path.
Example: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv`
If you want to refer to an output path of that store derivation, add the output name preceded by a caret (`^`).
If you want to refer to an output path of that derivation, add the output name preceded by a caret (`^`).
Example: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv^out`
@ -244,10 +244,10 @@ operate are determined as follows:
a command like `nix shell nixpkgs#libxml2` will provide only those
two outputs by default.
Note that a [store derivation] (given by its `.drv` file store path) doesn't have
Note that a [derivation] (given by its `.drv` file store path) doesn't have
any attributes like `meta`, and thus this case doesn't apply to it.
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: @docroot@/glossary.md#gloss-derivation
* Otherwise, Nix will use all outputs of the derivation.

View file

@ -68,9 +68,9 @@ R""(
]
```
* Print the path of the [store derivation] produced by `nixpkgs#hello`:
* Print the path of the [derivation] produced by `nixpkgs#hello`:
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: @docroot@/glossary.md#gloss-derivation
```console
# nix path-info --derivation nixpkgs#hello

View file

@ -62,8 +62,8 @@ R""(
# Description
`nix search` searches [*installable*](./nix.md#installables) (which can be evaluated, that is, a
flake or Nix expression, but not a store path or store derivation path) for packages whose name or description matches all of the
`nix search` searches [*installable*](./nix.md#installables) that can be evaluated, that is, a
flake or Nix expression, but not a [store path] or [deriving path]) for packages whose name or description matches all of the
regular expressions *regex*. For each matching package, It prints the
full attribute name (from the root of the [installable](./nix.md#installables)), the version
and the `meta.description` field, highlighting the substrings that
@ -75,6 +75,9 @@ it avoids highlighting the entire name and description of every package.
> Note that in this context, `^` is the regex character to match the beginning of a string, *not* the delimiter for
> [selecting a derivation output](@docroot@/command-ref/new-cli/nix.md#derivation-output-selection).
[store path]: @docroot@/glossary.md#gloss-store-path
[deriving path]: @docroot@/glossary.md#gloss-deriving-path
# Flake output attributes
If no flake output attribute is given, `nix search` searches for

View file

@ -18,9 +18,9 @@ R""(
(The flag `--substituters ''` avoids querying
`https://cache.nixos.org` for the log.)
* To copy the log for a specific [store derivation] via SSH:
* To copy the log for a specific [derivation] via SSH:
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: @docroot@/glossary.md#gloss--derivation
```console
# nix store copy-log --to ssh-ng://machine /nix/store/ilgm50plpmcgjhcp33z6n4qbnpqfhxym-glibc-2.33-59.drv