Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge remote-tracking branch 'NixOS/master' into lazy-trees #4

Draft
wants to merge 1 commit into
base: lazy-trees
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0
- name: Create backport PRs
# should be kept in sync with `version`
uses: zeebe-io/backport-action@v0.0.9
uses: zeebe-io/backport-action@v1.0.1
with:
# Config README: https://github.com/zeebe-io/backport-action#backport-action
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
77 changes: 0 additions & 77 deletions boehmgc-coroutine-sp-fallback.diff

This file was deleted.

2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier ('cpu-os')])
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var


CFLAGS=
CXXFLAGS=
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
Expand Down
14 changes: 14 additions & 0 deletions doc/manual/book.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
[book]
title = "Nix Reference Manual"

[output.html]
additional-css = ["custom.css"]
additional-js = ["redirects.js"]
edit-url-template = "https://github.com/NixOS/nix/tree/master/doc/manual/{path}"
git-repository-url = "https://github.com/NixOS/nix"

[preprocessor.anchors]
renderers = ["html"]
command = "jq --from-file doc/manual/anchors.jq"

[output.linkcheck]
# no Internet during the build (in the sandbox)
follow-web-links = false

# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
# excessive "Potential incomplete link" warnings. No other kind of warning was
# produced at the time of writing.
warning-policy = "ignore"
21 changes: 17 additions & 4 deletions doc/manual/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ $(d)/src/SUMMARY.md: $(d)/src/SUMMARY.md.in $(d)/src/command-ref/new-cli

$(d)/src/command-ref/new-cli: $(d)/nix.json $(d)/generate-manpage.nix $(bindir)/nix
@rm -rf $@
$(trace-gen) $(nix-eval) --write-to $@ --expr 'import doc/manual/generate-manpage.nix { toplevel = builtins.readFile $<; }'
$(trace-gen) $(nix-eval) --write-to $@.tmp --expr 'import doc/manual/generate-manpage.nix { toplevel = builtins.readFile $<; }'
# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable
$(trace-gen) sed -i $@.tmp/*.md -e 's^@docroot@^../..^g'
@mv $@.tmp $@

$(d)/src/command-ref/conf-file.md: $(d)/conf-file.json $(d)/generate-options.nix $(d)/src/command-ref/conf-file-prefix.md $(bindir)/nix
@cat doc/manual/src/command-ref/conf-file-prefix.md > $@.tmp
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-options.nix (builtins.fromJSON (builtins.readFile $<))' \
| sed -e 's^@docroot@^..^g'>> $@.tmp
@mv $@.tmp $@

$(d)/nix.json: $(bindir)/nix
Expand All @@ -67,7 +72,9 @@ $(d)/conf-file.json: $(bindir)/nix

$(d)/src/language/builtins.md: $(d)/builtins.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(bindir)/nix
@cat doc/manual/src/language/builtins-prefix.md > $@.tmp
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp
# @docroot@: https://nixos.org/manual/nix/unstable/contributing/hacking.html#docroot-variable
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' \
| sed -e 's^@docroot@^..^g' >> $@.tmp
@cat doc/manual/src/language/builtins-suffix.md >> $@.tmp
@mv $@.tmp $@

Expand Down Expand Up @@ -102,6 +109,12 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
@touch $@

$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md
$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
$(trace-gen) \
set -euo pipefail; \
RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual.tmp 2>&1 \
| { grep -Fv "because fragment resolution isn't implemented" || :; }
@rm -rf $(DESTDIR)$(docdir)/manual
@mv $(DESTDIR)$(docdir)/manual.tmp/html $(DESTDIR)$(docdir)/manual
@rm -rf $(DESTDIR)$(docdir)/manual.tmp

endif
2 changes: 2 additions & 0 deletions doc/manual/src/SUMMARY.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [Nix Language](language/index.md)
- [Data Types](language/values.md)
- [Language Constructs](language/constructs.md)
- [String interpolation](language/string-interpolation.md)
- [Operators](language/operators.md)
- [Derivations](language/derivations.md)
- [Advanced Attributes](language/advanced-attributes.md)
Expand Down Expand Up @@ -59,6 +60,7 @@
@manpages@
- [Files](command-ref/files.md)
- [nix.conf](command-ref/conf-file.md)
- [Architecture](architecture/architecture.md)
- [Glossary](glossary.md)
- [Contributing](contributing/contributing.md)
- [Hacking](contributing/hacking.md)
Expand Down
115 changes: 115 additions & 0 deletions doc/manual/src/architecture/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Architecture

This chapter describes how Nix works.
It should help users understand why Nix behaves as it does, and it should help developers understand how to modify Nix and how to write similar tools.

## Overview

Nix consists of [hierarchical layers].

[hierarchical layers]: https://en.m.wikipedia.org/wiki/Multitier_architecture#Layers

The following [concept map] shows its main components (rectangles), the objects they operate on (rounded rectangles), and their interactions (connecting phrases):

[concept map]: https://en.m.wikipedia.org/wiki/Concept_map

```

.----------------.
| Nix expression |----------.
'----------------' |
| passed to
| |
+----------|-------------------|--------------------------------+
| Nix | V |
| | +-------------------------+ |
| | | commmand line interface |------. |
| | +-------------------------+ | |
| | | | |
| evaluated by calls manages |
| | | | |
| | V | |
| | +--------------------+ | |
| '-------->| language evaluator | | |
| +--------------------+ | |
| | | |
| produces | |
| | V |
| +----------------------------|------------------------------+ |
| | store | | |
| | referenced by V builds | |
| | .-------------. .------------. .--------------. | |
| | | build input |----->| build plan |----->| build result | | |
| | '-------------' '------------' '--------------' | |
| +-------------------------------------------------|---------+ |
+---------------------------------------------------|-----------+
|
represented as
|
V
.---------------.
| file |
'---------------'
```

At the top is the [command line interface](../command-ref/command-ref.md) that drives the underlying layers.

The [Nix language](../language/index.md) evaluator transforms Nix expressions into self-contained *build plans*, which are used to derive *build results* from referenced *build inputs*.

The command line interface and Nix expressions are what users deal with most.

> **Note**
> The Nix language itself does not have a notion of *packages* or *configurations*.
> As far as we are concerned here, the inputs and results of a build plan are just data.

Underlying the command line interface and the Nix language evaluator is the [Nix store](../glossary.md#gloss-store), a mechanism to keep track of build plans, data, and references between them.
It can also execute build plans to produce new data, which are made available to the operating system as files.

A build plan itself is a series of *build tasks*, together with their build inputs.

> **Important**
> A build task in Nix is called [derivation](../glossary.md#gloss-derivation).

Each build task has a special build input executed as *build instructions* in order to perform the build.
The result of a build task can be input to another build task.

The following [data flow diagram] shows a build plan for illustration.
Build inputs used as instructions to a build task are marked accordingly:

[data flow diagram]: https://en.m.wikipedia.org/wiki/Data-flow_diagram

```
+--------------------------------------------------------------------+
| build plan |
| |
| .-------------. |
| | build input |---------. |
| '-------------' | |
| instructions |
| | |
| v |
| .-------------. .----------. |
| | build input |-->( build task )-------. |
| '-------------' '----------' | |
| instructions |
| | |
| v |
| .-------------. .----------. .--------------. |
| | build input |---------. ( build task )--->| build result | |
| '-------------' | '----------' '--------------' |
| instructions ^ |
| | | |
| v | |
| .-------------. .----------. | |
| | build input |-->( build task )-------' |
| '-------------' '----------' |
| ^ |
| | |
| | |
| .-------------. | |
| | build input |---------' |
| '-------------' |
| |
+--------------------------------------------------------------------+
```

2 changes: 1 addition & 1 deletion doc/manual/src/command-ref/env-common.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Most Nix commands interpret the following environment variables:
expressions using [paths](../language/values.md#type-path)
enclosed in angle brackets (i.e., `<path>`),
e.g. `/home/eelco/Dev:/etc/nixos`. It can be extended using the
[`-I` option](./opt-common#opt-I).
[`-I` option](./opt-common.md#opt-I).

- [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\
Normally, the Nix store directory (typically `/nix/store`) is not
Expand Down
4 changes: 3 additions & 1 deletion doc/manual/src/command-ref/nix-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ directory containing at least a file named `default.nix`.

`nix-build` is essentially a wrapper around
[`nix-instantiate`](nix-instantiate.md) (to translate a high-level Nix
expression to a low-level store derivation) and [`nix-store
expression to a low-level [store derivation]) and [`nix-store
--realise`](nix-store.md#operation---realise) (to build the store
derivation).

[store derivation]: ../glossary.md#gloss-store-derivation

> **Warning**
>
> The result of the build is automatically registered as a root of the
Expand Down
4 changes: 3 additions & 1 deletion doc/manual/src/command-ref/nix-copy-closure.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ authentication, you can avoid typing the passphrase with `ssh-agent`.
Enable compression of the SSH connection.

- `--include-outputs`\
Also copy the outputs of store derivations included in the closure.
Also copy the outputs of [store derivation]s included in the closure.

[store derivation]: ../glossary.md#gloss-store-derivation

- `--use-substitutes` / `-s`\
Attempt to download missing paths on the target machine using Nix’s
Expand Down
8 changes: 5 additions & 3 deletions doc/manual/src/command-ref/nix-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,12 @@ a number of possible ways:
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 derivation]s, then these are
[realised](nix-store.md#operation---realise), and the resulting output paths
are installed.

[store derivation]: ../glossary.md#gloss-store-derivation

- If *args* are store paths that are not store derivations, then these
are [realised](nix-store.md#operation---realise) and installed.

Expand Down Expand Up @@ -280,7 +282,7 @@ To copy the store path with symbolic name `gcc` from another profile:
$ nix-env -i --from-profile /nix/var/nix/profiles/foo gcc
```

To install a specific store derivation (typically created by
To install a specific [store derivation] (typically created by
`nix-instantiate`):

```console
Expand Down Expand Up @@ -665,7 +667,7 @@ derivation is shown unless `--no-name` is specified.
Print the `system` attribute of the derivation.

- `--drv-path`\
Print the path of the store derivation.
Print the path of the [store derivation].

- `--out-path`\
Print the output path of the derivation.
Expand Down
10 changes: 5 additions & 5 deletions doc/manual/src/command-ref/nix-instantiate.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

# Description

The command `nix-instantiate` generates [store
derivations](../glossary.md) from (high-level) Nix expressions. It
evaluates the Nix expressions in each of *files* (which defaults to
The command `nix-instantiate` produces [store derivation]s 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
derivation, a list of derivations, or a set of derivations. The paths
of the resulting store derivations are printed on standard output.

[store derivation]: ../glossary.md#gloss-store-derivation

If *files* is the character `-`, then a Nix expression will be read from
standard input.

Expand Down Expand Up @@ -79,8 +80,7 @@ standard input.

# Examples

Instantiating store derivations from a Nix expression, and building them
using `nix-store`:
Instantiate [store derivation]s from a Nix expression, and build them using `nix-store`:

```console
$ nix-instantiate test.nix (instantiate)
Expand Down
Loading