aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/architecture
diff options
context:
space:
mode:
authorValentin Gagarin <valentin.gagarin@tweag.io>2022-09-19 22:21:40 +0200
committerValentin Gagarin <valentin.gagarin@tweag.io>2022-11-09 01:29:01 +0100
commitbe8744f937150c65ffa5d98ffdc74c502dbcdd5e (patch)
treec331f632990e12035e384ed4b58f1be298b95fec /doc/manual/src/architecture
parent37358d0bcfd8fa38b7f652c837b8e9204a3c43f9 (diff)
manual: architecture overview
these changes were not merged properly and had to be reverted. see merge commit d8e54d19f71f78540dd967b2e42be6a5d8a0b1bb for full history leading up to here.
Diffstat (limited to 'doc/manual/src/architecture')
-rw-r--r--doc/manual/src/architecture/architecture.md77
1 files changed, 77 insertions, 0 deletions
diff --git a/doc/manual/src/architecture/architecture.md b/doc/manual/src/architecture/architecture.md
new file mode 100644
index 000000000..24150fc2b
--- /dev/null
+++ b/doc/manual/src/architecture/architecture.md
@@ -0,0 +1,77 @@
+# 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
+
+```
++---------------------------------------------------------------+
+| Nix |
+| [ commmand line interface ]------, |
+| | | |
+| evaluates | |
+| | manages |
+| V | |
+| [ configuration language ] | |
+| | | |
+| +----------------------------|-------------------V----------+ |
+| | store evaluates to | |
+| | | | |
+| | referenced by V builds | |
+| | [ build input ] ---> [ build plan ] ---> [ build result ] | |
+| | | |
+| +-----------------------------------------------------------+ |
++---------------------------------------------------------------+
+```
+
+At the top is the [command line interface](../command-ref/command-ref.md), translating from invocations of Nix executables to interactions with the underlying layers.
+
+Below that is the [Nix language](../language/index.md), a [purely functional] configuration language.
+It is used to compose expressions which ultimately evaluate to self-contained *build plans*, used to derive *build results* from referenced *build inputs*.
+
+[purely functional]: https://en.m.wikipedia.org/wiki/Purely_functional_programming
+
+Command line interface and Nix language are what users interact 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 these 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.
+
+A build plan is a series of *build tasks*.
+Each build task has a special build input, which is used as *build instructions*.
+The result of a build task can be input to another build task.
+
+> **Important**
+> A build task in Nix is called [derivation](../glossary#gloss-derivation).
+
+```
++----------------------------------------------------------------------------------+
+| store .............................................. |
+| : build plan : |
+| : : |
+| [ build input ]---instructions-, : |
+| : | : |
+| : v : |
+| [ build input ]--------->[ build task ]-instructions-, : |
+| : | : |
+| : v : |
+| [ build input ]---instructions-, [ build task ]--->[ build result ] |
+| : | ^ : |
+| : v | : |
+| [ build input ]--------->[ build task ]--------------' : |
+| : ^ : |
+| : | : |
+| [ build input ]----------------' : |
+| : : |
+| :............................................: |
++----------------------------------------------------------------------------------+
+```
+