Skip to content

Commit 1e00d14

Browse files
committed
manual: Edit
1 parent 2aa6e0f commit 1e00d14

File tree

8 files changed

+55
-27
lines changed

8 files changed

+55
-27
lines changed

doc/manual/source/advanced-topics/distributed-builds.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For a local machine to forward a build to a remote machine, the remote machine m
2020

2121
## Testing
2222

23-
To test connecting to a remote Nix instance (in this case `mac`), run:
23+
To test connecting to a remote [Nix instance] (in this case `mac`), run:
2424

2525
```console
2626
nix store info --store ssh://username@mac
@@ -106,3 +106,5 @@ file included in `builders` via the syntax `@/path/to/file`. For example,
106106

107107
causes the list of machines in `/etc/nix/machines` to be included.
108108
(This is the default.)
109+
110+
[Nix instance]: @docroot@/glossary.md#gloss-nix-instance

doc/manual/source/glossary.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Glossary
22

3+
- [build system]{#gloss-build-system}
4+
5+
Generic term for software that facilitates the building of software by automating the invocation of compilers, linkers, and other tools.
6+
7+
Nix can be used as a generic build system.
8+
It has no knowledge of any particular programming language or toolchain.
9+
These details are specified in [derivation expressions](#gloss-derivation-expression).
10+
311
- [content address]{#gloss-content-address}
412

513
A
@@ -19,6 +27,10 @@
1927

2028
Besides content addressing, the Nix store also uses [input addressing](#gloss-input-addressed-store-object).
2129

30+
- [content-addressed storage]{#gloss-content-addressed-store}
31+
32+
The industry term for storage and retrieval systems using [content addressing](#gloss-content-address). A Nix store also has [input addressing](#gloss-input-addressed-store-object), and metadata.
33+
2234
- [store derivation]{#gloss-store-derivation}
2335

2436
A single build task.
@@ -88,6 +100,12 @@
88100

89101
[store]: #gloss-store
90102

103+
- [Nix instance]{#gloss-nix-instance}
104+
<!-- ambiguous -->
105+
1. An installation of Nix, which includes the presence of a [store], and the Nix package manager which operates on that store.
106+
A local Nix installation and a [remote builder](@docroot@/advanced-topics/distributed-builds.md) are two examples of Nix instances.
107+
2. A running Nix process, such as the `nix` command.
108+
91109
- [binary cache]{#gloss-binary-cache}
92110

93111
A *binary cache* is a Nix store which uses a different format: its
@@ -220,7 +238,7 @@
220238
directly or indirectly “reachable” from that store path; that is,
221239
it’s the closure of the path under the *references* relation. For
222240
a package, the closure of its derivation is equivalent to the
223-
build-time dependencies, while the closure of its output path is
241+
build-time dependencies, while the closure of its [output path] is
224242
equivalent to its runtime dependencies. For correct deployment it
225243
is necessary to deploy whole closures, since otherwise at runtime
226244
files could be missing. The command `nix-store --query --requisites ` prints out

doc/manual/source/protocols/store-path.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ where
5353
method of content addressing store objects,
5454
if the hash algorithm is [SHA-256].
5555
Just like in the "Text" case, we can have the store objects referenced by their paths.
56-
Additionally, we can have an optional `:self` label to denote self reference.
56+
Additionally, we can have an optional `:self` label to denote self-reference.
5757
5858
- ```ebnf
5959
| "output:" id

doc/manual/source/store/building.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The [`builder`](./derivation/index.md#builder) is executed as follows:
5454
it’s `out`.)
5555

5656
- If an output path already exists, it is removed. Also, locks are
57-
acquired to prevent multiple Nix instances from performing the same
57+
acquired to prevent multiple [Nix instances][Nix instance] from performing the same
5858
build at the same time.
5959

6060
- A log of the combined standard output and error is written to
@@ -95,3 +95,6 @@ If the builder exited successfully, the following steps happen in order to turn
9595

9696
Nix also scans for references to other outputs' paths in the same way, because outputs are allowed to refer to each other.
9797
If the outputs' references to each other form a cycle, this is an error, because the references of store objects much be acyclic.
98+
99+
100+
[Nix instance]: @docroot@/glossary.md#gloss-nix-instance

doc/manual/source/store/derivation/index.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Store Derivation and Deriving Path
22

3-
Besides functioning as a [content addressed store] the Nix store layer works as a [build system].
4-
Other system (like Git or IPFS) also store and transfer immutable data, but they don't concern themselves with *how* that data was created.
3+
Besides functioning as a [content-addressed store], the Nix store layer works as a [build system].
4+
Other systems (like Git or IPFS) also store and transfer immutable data, but they don't concern themselves with *how* that data was created.
55

66
This is where Nix distinguishes itself.
77
*Derivations* represent individual build steps, and *deriving paths* are needed to refer to the *outputs* of those build steps before they are built.
@@ -42,6 +42,8 @@ A derivation consists of:
4242
[args]: #args
4343
[env]: #env
4444
[system]: #system
45+
[content-addressed store]: @docroot@/glossary.md#gloss-content-addressed-store
46+
[build system]: @docroot@/glossary.md#gloss-build-system
4547

4648
### Referencing derivations {#derivation-path}
4749

@@ -78,7 +80,7 @@ type DerivingPath = ConstantPath | OutputPath;
7880
```
7981

8082
Deriving paths are necessary because, in general and particularly for [content-addressing derivations][content-addressing derivation], the [store path] of an [output] is not known in advance.
81-
We can use an output deriving path to refer to such an out, instead of the store path which we do not yet know.
83+
We can use an output deriving path to refer to such an output, instead of the store path which we do not yet know.
8284

8385
[deriving path]: #deriving-path
8486
[validity]: @docroot@/glossary.md#gloss-validity
@@ -89,25 +91,26 @@ A derivation is constructed from the parts documented in the following subsectio
8991

9092
### Inputs {#inputs}
9193

92-
The inputs are a set of [deriving paths][deriving path], refering to all store objects needed in order to perform this build step.
94+
The inputs are a set of [deriving paths][deriving path], referring to all store objects needed in order to perform this build step.
9395

9496
The [process creation fields] will presumably include many [store paths][store path]:
9597

9698
- The path to the executable normally starts with a store path
9799
- The arguments and environment variables likely contain many other store paths.
98100

99-
But rather than somehow scanning all the other fields for inputs, Nix requires that all inputs be explicitly collected in the inputs field. It is instead the responsibility of the creator of a derivation (e.g. the evaluator) to ensure that every store object referenced in another field (e.g. referenced by store path) is included in this inputs field.
101+
But rather than somehow scanning all the other fields for inputs, Nix requires that all inputs be explicitly collected in the inputs field. It is instead the responsibility of the creator of a derivation (e.g. the evaluator) to ensure that every store object referenced in another field (e.g. referenced by store path) is included in this inputs field.
100102

101103
### System {#system}
102104

103105
The system type on which the [`builder`](#attr-builder) executable is meant to be run.
104106

105-
A necessary condition for Nix to schedule a given derivation on some Nix instance is for the "system" of that derivation to match that instance's [`system` configuration option].
107+
A necessary condition for Nix to schedule a given derivation on some [Nix instance] is for the "system" of that derivation to match that instance's [`system` configuration option] or [`extra-platforms` configuration option].
106108

107109
By putting the `system` in each derivation, Nix allows *heterogenous* build plans, where not all steps can be run on the same machine or same sort of machine.
108110
Nix can schedule builds such that it automatically builds on other platforms by [forwarding build requests](@docroot@/advanced-topics/distributed-builds.md) to other Nix instances.
109111

110112
[`system` configuration option]: @docroot@/command-ref/conf-file.md#conf-system
113+
[`extra-platforms` configuration option]: @docroot@/command-ref/conf-file.md#conf-extra-platforms
111114

112115
[content-addressing derivation]: @docroot@/glossary.md#gloss-content-addressing-derivation
113116
[realise]: @docroot@/glossary.md#gloss-realise
@@ -240,14 +243,14 @@ That works because we've implicitly assumed that all derivations are created *st
240243
But what if derivations could also be created dynamically within Nix?
241244
In other words, what if derivations could be the outputs of other derivations?
242245
243-
:::{.note}
244-
In the parlance of "Build Systems à la carte", we are generalizing the Nix store layer to be a "Monadic" instead of "Applicative" build system.
245-
:::
246+
> **Note**
247+
>
248+
> In the parlance of "Build Systems à la carte", we are generalizing the Nix store layer to be a "Monadic" instead of "Applicative" build system.
246249
247250
How should we refer to such derivations?
248251
A deriving path works, the same as how we refer to other derivation outputs.
249252
But what about a dynamic derivations output?
250-
(i.e. how do we refer to the output of an output of a derivation?)
253+
(i.e. how do we refer to the output of a derivation, which is itself an output of a derivation?)
251254
For that we need to generalize the definition of deriving path, replacing the store path used to refer to the derivation with a nested deriving path:
252255
253256
```diff
@@ -295,3 +298,5 @@ The result of this is that it is possible to have a chain of `^<output-name>` at
295298
> |------------------------------------------------------------| |-----|
296299
> innermost constant store path (usual encoding) output name
297300
> ```
301+
302+
[Nix instance]: @docroot@/glossary.md#gloss-nix-instance

doc/manual/source/store/derivation/outputs/content-address.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Given the method, the output's name (computed from the derivation name and outpu
1212

1313
## Fixed-output content-addressing {#fixed}
1414

15-
In this case the content-address of the *fixed* in advanced by the derivation itself.
15+
In this case the content address of the *fixed* in advanced by the derivation itself.
1616
In other words, when the derivation has finished [building](@docroot@/store/building.md), and the provisional output' content-address is computed as part of the process to turn it into a *bona fide* store object, the calculated content address must much that given in the derivation, or the build of that derivation will be deemed a failure.
1717

1818
The output spec for an output with a fixed content addresses additionally contains:
@@ -159,7 +159,7 @@ A *determinstic* content-addressing derivation should produce outputs with the s
159159
160160
### Floating versus Fixed
161161
162-
While the destinction between content- and input-addressing is one of *mechanism*, the distinction between fixed and floating content addression is more one of *policy*.
162+
While the distinction between content- and input-addressing is one of *mechanism*, the distinction between fixed and floating content addressing is more one of *policy*.
163163
A fixed output that passes its content address check is just like a floating output.
164164
It is only in the potential for that check to fail that they are different.
165165

doc/manual/source/store/derivation/outputs/input-address.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[input addressing]: #input-addressing
44

55
"Input addressing" means the address the store object by the *way it was made* rather than *what it is*.
6-
That is to say, an input-addressed output's store path is a function not of the output itself, but the derivation that produced it.
6+
That is to say, an input-addressed output's store path is a function not of the output itself, but of the derivation that produced it.
77
Even if two store paths have the same contents, if they are produced in different ways, and one is input-addressed, then they will have different store paths, and thus guaranteed to not be the same store object.
88

99
<!---

doc/manual/source/store/store-object/content-address.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ With all currently-supported store object content-addressing methods, the file s
2828

2929
### References
3030

31-
#### References to other store object#### References to other store objectss
31+
#### References to other store objects
3232

3333
With all currently supported store object content addressing methods,
3434
other objects are referred to by their regular (string-encoded-) [store paths][Store Path].
@@ -44,28 +44,28 @@ Self-references however cannot be referred to by their path, because we are in t
4444
> which is computationally infeasible.
4545
> As far as we know, this is equivalent to finding a hash collision.
4646
47-
Instead we have a "has self reference" boolean, which end up affecting the digest:
48-
In all currently-supported store object content-addressing methods, when hashing the file system object data, any occurence of store objects own store path in the digested data is replaced with a [sentinal value](https://en.wikipedia.org/wiki/Sentinel_value).
47+
Instead we have a "has self-reference" boolean, which ends up affecting the digest:
48+
In all currently-supported store object content-addressing methods, when hashing the file system object data, any occurence of store object's own store path in the digested data is replaced with a [sentinel value](https://en.wikipedia.org/wiki/Sentinel_value).
4949
The hashes of these modified input streams are used instead.
5050
51-
When validating the content-address of a store object after the fact, the above process works as written.
51+
When validating the content address of a store object after the fact, the above process works as written.
5252
However, when first creating the store object we don't know the store object's store path, as explained just above.
5353
We therefore, strictly speaking, do not know what value we will be replacing with the sentinental value in the inputs to hash functions.
54-
What instead happens is that the provisional store object --- the data from which we wish to create a store object --- is paired with a provisional "scratch" store path (that presumably was choosen when the data was created).
55-
That provisional store path is instead what is replaced with the sentinal value, rather than the final store object which we do not yet know.
54+
What instead happens is that the provisional store object --- the data from which we wish to create a store object --- is paired with a provisional "scratch" store path (that presumably was chosen when the data was created).
55+
That provisional store path is instead what is replaced with the sentinel value, rather than the final store object which we do not yet know.
5656
5757
> **Design note**
5858
>
5959
> It is an informal property of content-addressed store objects that the choice of provisional store path should not matter.
6060
> In other words, if a provisional store object is prepared in the same way except for the choice of provision store path, the provisional data need not be identical.
61-
> But, after the sentinal value is substituted in place of each provisional store object's provision store path, the final so-normalized data *should* be identifical.
61+
> But, after the sentinel value is substituted in place of each provisional store object's provision store path, the final so-normalized data *should* be identical.
6262
>
6363
> If, conversely, the data after this normalization process is still different, we'll compute a different content-address.
6464
> The method of preparing the provisional self-referenced data has *failed* to be deterministic in the sense of not *leaking* the choice of provisional store path --- a choice which is supposed to be arbitrary --- into the final store object.
6565
>
6666
> This property is informal because at this stage, we are just described store objects, which have no formal notion of their origin.
6767
> Without such a formal notion, there is nothing to formally accuse of being insufficiently deterministic.
68-
> Later in this chapter, when we cover [derivations](@docroot@/store/derivation/index.md), we will have a chance to make this a formal property, not of content-addressed store objects themselves, but of derivations that *produce* content-addressed store objects.
68+
> Where we cover [derivations](@docroot@/store/derivation/index.md), we will have a chance to make this a formal property, not of content-addressed store objects themselves, but of derivations that *produce* content-addressed store objects.
6969
7070
### Name and Store Directory
7171
@@ -88,7 +88,7 @@ References are not supported: store objects with flat hashing *and* references c
8888
8989
This also uses the corresponding [Flat](../file-system-object/content-address.md#serial-flat) method of file system object content addressing.
9090
91-
References to other store objects are supported, but self references are not.
91+
References to other store objects are supported, but self-references are not.
9292
9393
This is the only store-object content-addressing method that is not named identically with a corresponding file system object method.
9494
It is somewhat obscure, mainly used for "drv files"
@@ -99,7 +99,7 @@ Prefer another method if possible.
9999
100100
This uses the corresponding [Nix Archive](../file-system-object/content-address.md#serial-nix-archive) method of file system object content addressing.
101101
102-
References (to other store objects and self references alike) are supported so long as the hash algorithm is SHA-256, but not (neither kind) otherwise.
102+
References (to other store objects and self-references alike) are supported so long as the hash algorithm is SHA-256, but not (neither kind) otherwise.
103103
104104
### Git { #method-git }
105105

0 commit comments

Comments
 (0)