about summary refs log tree commit diff
path: root/nixos/doc
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2023-11-28 01:32:53 +0100
committernikstur <nikstur@outlook.com>2024-01-22 00:54:13 +0100
commitdbd8cb9d460aefddce0afd09ffdce5271a6f36bd (patch)
tree0f7971aa7a5c7d38479b91c7f0422f85633b0c8f /nixos/doc
parent60f529fc8277f1e49082a8c240cdfba6d5a5c794 (diff)
downloadnixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar.gz
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar.bz2
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar.lz
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar.xz
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.tar.zst
nixlib-dbd8cb9d460aefddce0afd09ffdce5271a6f36bd.zip
nixos/etc: add manual section
Diffstat (limited to 'nixos/doc')
-rw-r--r--nixos/doc/manual/development/etc-overlay.section.md36
-rw-r--r--nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md1
2 files changed, 37 insertions, 0 deletions
diff --git a/nixos/doc/manual/development/etc-overlay.section.md b/nixos/doc/manual/development/etc-overlay.section.md
new file mode 100644
index 000000000000..e6f6d8d4ca1e
--- /dev/null
+++ b/nixos/doc/manual/development/etc-overlay.section.md
@@ -0,0 +1,36 @@
+# `/etc` via overlay filesystem {#sec-etc-overlay}
+
+::: {.note}
+This is experimental and requires a kernel version >= 6.6 because it uses
+new overlay features and relies on the new mount API.
+:::
+
+Instead of using a custom perl script to activate `/etc`, you activate it via an
+overlay filesystem:
+
+```nix
+system.etc.overlay.enable = true;
+```
+
+Using an overlay has two benefits:
+
+1. it removes a dependency on perl
+2. it makes activation faster (up to a few seconds)
+
+By default, the `/etc` overlay is mounted writable (i.e. there is a writable
+upper layer). However, you can also mount `/etc` immutably (i.e. read-only) by
+setting:
+
+```nix
+system.etc.overlay.mutable = false;
+```
+
+The overlay is atomically replaced during system switch. However, files that
+have been modified will NOT be overwritten. This is the biggest change compared
+to the perl-based system.
+
+If you manually make changes to `/etc` on your system and then switch to a new
+configuration where `system.etc.overlay.mutable = false;`, you will not be able
+to see the previously made changes in `/etc` anymore. However the changes are
+not completely gone, they are still in the upperdir of the previous overlay in
+`/.rw-etc/upper`.
diff --git a/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md b/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md
index 5d17a9c98514..28c06f999dac 100644
--- a/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md
+++ b/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md
@@ -56,4 +56,5 @@ explained in the next sections.
 unit-handling.section.md
 activation-script.section.md
 non-switchable-systems.section.md
+etc-overlay.section.md
 ```