aboutsummaryrefslogtreecommitdiff
path: root/doc/manual
diff options
context:
space:
mode:
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/redirects.js2
-rw-r--r--doc/manual/src/SUMMARY.md.in4
-rw-r--r--doc/manual/src/architecture/file-system-object.md64
-rw-r--r--doc/manual/src/command-ref/conf-file-prefix.md86
-rw-r--r--doc/manual/src/command-ref/nix-build.md5
-rw-r--r--doc/manual/src/contributing/cxx.md28
-rw-r--r--doc/manual/src/glossary.md15
-rw-r--r--doc/manual/src/language/index.md9
8 files changed, 166 insertions, 47 deletions
diff --git a/doc/manual/redirects.js b/doc/manual/redirects.js
index 5cd6fdea2..bddd56eb8 100644
--- a/doc/manual/redirects.js
+++ b/doc/manual/redirects.js
@@ -340,6 +340,8 @@ const redirects = {
"attribute-sets": "#attribute-set"
},
"installation/installing-binary.html": {
+ "linux": "uninstall.html#linux",
+ "macos": "uninstall.html#macos",
"uninstalling": "uninstall.html"
}
};
diff --git a/doc/manual/src/SUMMARY.md.in b/doc/manual/src/SUMMARY.md.in
index cfbb38be8..bbb603713 100644
--- a/doc/manual/src/SUMMARY.md.in
+++ b/doc/manual/src/SUMMARY.md.in
@@ -97,7 +97,8 @@
- [manifest.json](command-ref/files/manifest.json.md)
- [Channels](command-ref/files/channels.md)
- [Default Nix expression](command-ref/files/default-nix-expression.md)
-- [Architecture](architecture/architecture.md)
+- [Architecture and Design](architecture/architecture.md)
+ - [File System Object](architecture/file-system-object.md)
- [Protocols](protocols/protocols.md)
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
- [Glossary](glossary.md)
@@ -105,6 +106,7 @@
- [Hacking](contributing/hacking.md)
- [Experimental Features](contributing/experimental-features.md)
- [CLI guideline](contributing/cli-guideline.md)
+ - [C++ style guide](contributing/cxx.md)
- [Release Notes](release-notes/release-notes.md)
- [Release X.Y (202?-??-??)](release-notes/rl-next.md)
- [Release 2.16 (2023-05-31)](release-notes/rl-2.16.md)
diff --git a/doc/manual/src/architecture/file-system-object.md b/doc/manual/src/architecture/file-system-object.md
new file mode 100644
index 000000000..42f047260
--- /dev/null
+++ b/doc/manual/src/architecture/file-system-object.md
@@ -0,0 +1,64 @@
+# File System Object
+
+Nix uses a simplified model of the file system, which consists of file system objects.
+Every file system object is one of the following:
+
+ - File
+
+ - A possibly empty sequence of bytes for contents
+ - A single boolean representing the [executable](https://en.m.wikipedia.org/wiki/File-system_permissions#Permissions) permission
+
+ - Directory
+
+ Mapping of names to child file system objects
+
+ - [Symbolic link](https://en.m.wikipedia.org/wiki/Symbolic_link)
+
+ An arbitrary string.
+ Nix does not assign any semantics to symbolic links.
+
+File system objects and their children form a tree.
+A bare file or symlink can be a root file system object.
+
+Nix does not encode any other file system notions such as [hard links](https://en.m.wikipedia.org/wiki/Hard_link), [permissions](https://en.m.wikipedia.org/wiki/File-system_permissions), timestamps, or other metadata.
+
+## Examples of file system objects
+
+A plain file:
+
+```
+50 B, executable: false
+```
+
+An executable file:
+
+```
+122 KB, executable: true
+```
+
+A symlink:
+
+```
+-> /usr/bin/sh
+```
+
+A directory with contents:
+
+```
+├── bin
+│   └── hello: 35 KB, executable: true
+└── share
+ ├── info
+ │   └── hello.info: 36 KB, executable: false
+ └── man
+ └── man1
+ └── hello.1.gz: 790 B, executable: false
+```
+
+A directory that contains a symlink and other directories:
+
+```
+├── bin -> share/go/bin
+├── nix-support/
+└── share/
+```
diff --git a/doc/manual/src/command-ref/conf-file-prefix.md b/doc/manual/src/command-ref/conf-file-prefix.md
index 44b7ba86d..1e4085977 100644
--- a/doc/manual/src/command-ref/conf-file-prefix.md
+++ b/doc/manual/src/command-ref/conf-file-prefix.md
@@ -4,49 +4,67 @@
# Description
-By default Nix reads settings from the following places:
+Nix supports a variety of configuration settings, which are read from configuration files or taken as command line flags.
- - The system-wide configuration file `sysconfdir/nix/nix.conf` (i.e.
- `/etc/nix/nix.conf` on most systems), or `$NIX_CONF_DIR/nix.conf` if
- `NIX_CONF_DIR` is set. Values loaded in this file are not forwarded
- to the Nix daemon. The client assumes that the daemon has already
- loaded them.
+## Configuration file
- - If `NIX_USER_CONF_FILES` is set, then each path separated by `:`
- will be loaded in reverse order.
+By default Nix reads settings from the following places, in that order:
- Otherwise it will look for `nix/nix.conf` files in `XDG_CONFIG_DIRS`
- and `XDG_CONFIG_HOME`. If unset, `XDG_CONFIG_DIRS` defaults to
- `/etc/xdg`, and `XDG_CONFIG_HOME` defaults to `$HOME/.config`
- as per [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).
+1. The system-wide configuration file `sysconfdir/nix/nix.conf` (i.e. `/etc/nix/nix.conf` on most systems), or `$NIX_CONF_DIR/nix.conf` if [`NIX_CONF_DIR`](./env-common.md#env-NIX_CONF_DIR) is set.
- - If `NIX_CONFIG` is set, its contents is treated as the contents of
- a configuration file.
+ Values loaded in this file are not forwarded to the Nix daemon.
+ The client assumes that the daemon has already loaded them.
-The configuration files consist of `name = value` pairs, one per
-line. Other files can be included with a line like `include path`,
-where *path* is interpreted relative to the current conf file and a
-missing file is an error unless `!include` is used instead. Comments
-start with a `#` character. Here is an example configuration file:
+1. If [`NIX_USER_CONF_FILES`](./env-common.md#env-NIX_USER_CONF_FILES) is set, then each path separated by `:` will be loaded in reverse order.
- keep-outputs = true # Nice for developers
- keep-derivations = true # Idem
+ Otherwise it will look for `nix/nix.conf` files in `XDG_CONFIG_DIRS` and [`XDG_CONFIG_HOME`](./env-common.md#env-XDG_CONFIG_HOME).
+ If unset, `XDG_CONFIG_DIRS` defaults to `/etc/xdg`, and `XDG_CONFIG_HOME` defaults to `$HOME/.config` as per [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).
-You can override settings on the command line using the `--option`
-flag, e.g. `--option keep-outputs false`. Every configuration setting
-also has a corresponding command line flag, e.g. `--max-jobs 16`; for
-Boolean settings, there are two flags to enable or disable the setting
-(e.g. `--keep-failed` and `--no-keep-failed`).
+1. If [`NIX_CONFIG`](./env-common.md#env-NIX_CONFIG) is set, its contents are treated as the contents of a configuration file.
-A configuration setting usually overrides any previous value. However,
-you can prefix the name of the setting by `extra-` to *append* to the
-previous value. For instance,
+### File format
- substituters = a b
- extra-substituters = c d
+Configuration files consist of `name = value` pairs, one per line.
+Comments start with a `#` character.
-defines the `substituters` setting to be `a b c d`. This is also
-available as a command line flag (e.g. `--extra-substituters`).
+Example:
-The following settings are currently available:
+```
+keep-outputs = true # Nice for developers
+keep-derivations = true # Idem
+```
+
+Other files can be included with a line like `include <path>`, where `<path>` is interpreted relative to the current configuration file.
+A missing file is an error unless `!include` is used instead.
+
+A configuration setting usually overrides any previous value.
+However, for settings that take a list of items, you can prefix the name of the setting by `extra-` to *append* to the previous value.
+
+For instance,
+
+```
+substituters = a b
+extra-substituters = c d
+```
+
+defines the `substituters` setting to be `a b c d`.
+
+Unknown option names are not an error, and are simply ignored with a warning.
+
+## Command line flags
+
+Configuration options can be set on the command line, overriding the values set in the [configuration file](#configuration-file):
+
+- Every configuration setting has corresponding command line flag (e.g. `--max-jobs 16`).
+ Boolean settings do not need an argument, and can be explicitly disabled with the `no-` prefix (e.g. `--keep-failed` and `--no-keep-failed`).
+
+ Unknown option names are invalid flags (unless there is already a flag with that name), and are rejected with an error.
+
+- The flag `--option <name> <value>` is interpreted exactly like a `<name> = <value>` in a setting file.
+
+ Unknown option names are ignored with a warning.
+
+The `extra-` prefix is supported for settings that take a list of items (e.g. `--extra-trusted users alice` or `--option extra-trusted-users alice`).
+
+# Available settings
diff --git a/doc/manual/src/command-ref/nix-build.md b/doc/manual/src/command-ref/nix-build.md
index f70bbd7f2..7369ea2eb 100644
--- a/doc/manual/src/command-ref/nix-build.md
+++ b/doc/manual/src/command-ref/nix-build.md
@@ -51,8 +51,9 @@ derivation).
# Options
-All options not listed here are passed to `nix-store --realise`,
-except for `--arg` and `--attr` / `-A` which are passed to `nix-instantiate`.
+All options not listed here are passed to
+[`nix-store --realise`](nix-store/realise.md),
+except for `--arg` and `--attr` / `-A` which are passed to [`nix-instantiate`](nix-instantiate.md).
- <span id="opt-no-out-link">[`--no-out-link`](#opt-no-out-link)<span>
diff --git a/doc/manual/src/contributing/cxx.md b/doc/manual/src/contributing/cxx.md
new file mode 100644
index 000000000..ff9297158
--- /dev/null
+++ b/doc/manual/src/contributing/cxx.md
@@ -0,0 +1,28 @@
+# C++ style guide
+
+Some miscellaneous notes on how we write C++.
+Formatting we hope to eventually normalize automatically, so this section is free to just discuss higher-level concerns.
+
+## The `*-impl.hh` pattern
+
+Let's start with some background info first.
+Headers, are supposed to contain declarations, not definitions.
+This allows us to change a definition without changing the declaration, and have a very small rebuild during development.
+Templates, however, need to be specialized to use-sites.
+Absent fancier techniques, templates require that the definition, not just mere declaration, must be available at use-sites in order to make that specialization on the fly as part of compiling those use-sites.
+Making definitions available like that means putting them in headers, but that is unfortunately means we get all the extra rebuilds we want to avoid by just putting declarations there as described above.
+
+The `*-impl.hh` pattern is a ham-fisted partial solution to this problem.
+It constitutes:
+
+- Declaring items only in the main `foo.hh`, including templates.
+
+- Putting template definitions in a companion `foo-impl.hh` header.
+
+Most C++ developers would accompany this by having `foo.hh` include `foo-impl.hh`, to ensure any file getting the template declarations also got the template definitions.
+But we've found not doing this has some benefits and fewer than imagined downsides.
+The fact remains that headers are rarely as minimal as they could be;
+there is often code that needs declarations from the headers but not the templates within them.
+With our pattern where `foo.hh` doesn't include `foo-impl.hh`, that means they can just include `foo.hh`
+Code that needs both just includes `foo.hh` and `foo-impl.hh`.
+This does make linking error possible where something forgets to include `foo-impl.hh` that needs it, but those are build-time only as easy to fix.
diff --git a/doc/manual/src/glossary.md b/doc/manual/src/glossary.md
index 47a484826..ac0bb3c2f 100644
--- a/doc/manual/src/glossary.md
+++ b/doc/manual/src/glossary.md
@@ -85,12 +85,17 @@
[store path]: #gloss-store-path
+ - [file system object]{#gloss-store-object}\
+ The Nix data model for representing simplified file system data.
+
+ See [File System Object](@docroot@/architecture/file-system-object.md) for details.
+
+ [file system object]: #gloss-file-system-object
+
- [store object]{#gloss-store-object}\
- A file that is an immediate child of the Nix store directory. These
- can be regular files, but also entire directory trees. Store objects
- can be sources (objects copied from outside of the store),
- derivation outputs (objects produced by running a build task), or
- derivations (files describing a build task).
+
+ A store object consists of a [file system object], [reference]s to other store objects, and other metadata.
+ It can be referred to by a [store path].
[store object]: #gloss-store-object
diff --git a/doc/manual/src/language/index.md b/doc/manual/src/language/index.md
index 3eabe1a02..29950a52d 100644
--- a/doc/manual/src/language/index.md
+++ b/doc/manual/src/language/index.md
@@ -1,12 +1,11 @@
# Nix Language
-The Nix language is
+The Nix language is designed for conveniently creating and composing *derivations* – precise descriptions of how contents of existing files are used to derive new files.
+It is:
- *domain-specific*
- It only exists for the Nix package manager:
- to describe packages and configurations as well as their variants and compositions.
- It is not intended for general purpose use.
+ It comes with [built-in functions](@docroot@/language/builtins.md) to integrate with the Nix store, which manages files and performs the derivations declared in the Nix language.
- *declarative*
@@ -25,7 +24,7 @@ The Nix language is
- *lazy*
- Expressions are only evaluated when their value is needed.
+ Values are only computed when they are needed.
- *dynamically typed*