1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-19 07:21:07 +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

@ -4,9 +4,9 @@ The most important built-in function is `derivation`, which is used to describe
a specification for running an executable on precisely defined input files to repeatably produce output files at uniquely determined file system paths.
It takes as input an attribute set, the attributes of which specify the inputs to the process.
It outputs an attribute set, and produces a [store derivation] as a side effect of evaluation.
It outputs an attribute set, and produces a [derivation] as a side effect of evaluation.
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
[derivation]: @docroot@/glossary.md#gloss-derivation
## Input attributes
@ -15,7 +15,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
- [`name`]{#attr-name} ([String](@docroot@/language/types.md#type-string))
A symbolic name for the derivation.
It is added to the [store path] of the corresponding [store derivation] as well as to its [output paths](@docroot@/glossary.md#gloss-output-path).
It is added to the [store path] of the corresponding [derivation] as well as to its [output paths](@docroot@/glossary.md#gloss-output-path).
[store path]: @docroot@/store/store-path.md
@ -28,7 +28,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
> }
> ```
>
> The store derivation's path will be `/nix/store/<hash>-hello.drv`.
> The derivation's path will be `/nix/store/<hash>-hello.drv`.
> The [output](#attr-outputs) paths will be of the form `/nix/store/<hash>-hello[-<output>]`
- [`system`]{#attr-system} ([String](@docroot@/language/types.md#type-string))
@ -182,7 +182,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
> }
> ```
>
> The store derivation path will be `/nix/store/<hash>-example.drv`.
> The derivation path will be `/nix/store/<hash>-example.drv`.
> The output paths will be
> - `/nix/store/<hash>-example-lib`
> - `/nix/store/<hash>-example-dev`

View file

@ -71,9 +71,10 @@ Boxes are data structures, arrow labels are transformations.
| evaluate | | |
| | | | |
| V | | |
| .------------. | | .------------------. |
| | derivation |----|-instantiate-|->| store derivation | |
| '------------' | | '------------------' |
| .------------. | | |
| | derivation | | | .------------. |
| | expression |----|-instantiate-|---->| derivation | |
| '------------' | | '------------' |
| | | | |
| | | realise |
| | | | |

View file

@ -22,7 +22,7 @@ Rather than writing
"--with-freetype2-library=" + freetype + "/lib"
```
(where `freetype` is a [derivation]), you can instead write
(where `freetype` is an [output path]), you can instead write
[derivation]: @docroot@/glossary.md#gloss-derivation
@ -148,7 +148,7 @@ An expression that is interpolated must evaluate to one of the following:
- `__toString` must be a function that takes the attribute set itself and returns a string
- `outPath` must be a string
This includes [derivations](./derivations.md) or [flake inputs](@docroot@/command-ref/new-cli/nix3-flake.md#flake-inputs) (experimental).
This includes [derivation expressions](./derivations.md) or [flake inputs](@docroot@/command-ref/new-cli/nix3-flake.md#flake-inputs) (experimental).
A string interpolates to itself.