aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/architecture/architecture.md
diff options
context:
space:
mode:
authorThéophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>2022-08-04 20:49:01 +0200
committerGitHub <noreply@github.com>2022-08-04 20:49:01 +0200
commit81e101345fda2a8651c470f08b364a1ca6fa37cf (patch)
tree77f1972839dba73b6541d871cc91bab622c6f99b /doc/manual/src/architecture/architecture.md
parent7d1280bbaf7f4cd142c2259dec620c42bf6f96fd (diff)
parent39d32ac4c63f4aa3784d114b19c0eca83e306ca9 (diff)
Merge pull request #6420 from nix-community/doc-what-is-nix
Document what Nix *is*
Diffstat (limited to 'doc/manual/src/architecture/architecture.md')
-rw-r--r--doc/manual/src/architecture/architecture.md79
1 files changed, 79 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..41deb07af
--- /dev/null
+++ b/doc/manual/src/architecture/architecture.md
@@ -0,0 +1,79 @@
+# Architecture
+
+*(This chapter is unstable and a work in progress. Incoming links may rot.)*
+
+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][layer-architecture].
+
+```
++-----------------------------------------------------------------+
+| 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 expression language](../expressions/expression-language.md), a [purely functional][purely-functional-programming] 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*.
+
+The command line 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](./store/store.md), 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.
+
+```
++-----------------------------------------------------------------------------------------+
+| store |
+| ................................................. |
+| : build plan : |
+| : : |
+| [ build input ]-----instructions-, : |
+| : | : |
+| : v : |
+| [ build input ]----------->[ build task ]--instructions-, : |
+| : | : |
+| : | : |
+| : v : |
+| : [ build task ]----->[ build result ] |
+| [ build input ]-----instructions-, ^ : |
+| : | | : |
+| : v | : |
+| [ build input ]----------->[ build task ]---------------' : |
+| : ^ : |
+| : | : |
+| [ build input ]------------------' : |
+| : : |
+| : : |
+| :...............................................: |
+| |
++-----------------------------------------------------------------------------------------+
+```
+
+[layer-architecture]: https://en.m.wikipedia.org/wiki/Multitier_architecture#Layers
+[purely-functional-programming]: https://en.m.wikipedia.org/wiki/Purely_functional_programming