about summary refs log tree commit diff
path: root/nixos/doc/manual
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2024-02-04 00:29:42 +0100
committernikstur <nikstur@outlook.com>2024-02-07 22:13:00 +0100
commit1407ec7420dac14e80dba8e6393cec78f2d4571a (patch)
tree84affb40781813eef37d81a964457ddc8aa004de /nixos/doc/manual
parent1c1cfa073a80354fc2814265f1550bd537c01908 (diff)
downloadnixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar.gz
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar.bz2
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar.lz
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar.xz
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.tar.zst
nixlib-1407ec7420dac14e80dba8e6393cec78f2d4571a.zip
nixos/filesystems: add overlayfs docs
Diffstat (limited to 'nixos/doc/manual')
-rw-r--r--nixos/doc/manual/configuration/file-systems.chapter.md1
-rw-r--r--nixos/doc/manual/configuration/overlayfs.section.md27
2 files changed, 28 insertions, 0 deletions
diff --git a/nixos/doc/manual/configuration/file-systems.chapter.md b/nixos/doc/manual/configuration/file-systems.chapter.md
index aca978be064d..3dfdd20ac33e 100644
--- a/nixos/doc/manual/configuration/file-systems.chapter.md
+++ b/nixos/doc/manual/configuration/file-systems.chapter.md
@@ -39,4 +39,5 @@ and non-critical by adding `options = [ "nofail" ];`.
 ```{=include=} sections
 luks-file-systems.section.md
 sshfs-file-systems.section.md
+overlayfs.section.md
 ```
diff --git a/nixos/doc/manual/configuration/overlayfs.section.md b/nixos/doc/manual/configuration/overlayfs.section.md
new file mode 100644
index 000000000000..592fb7c2e6f7
--- /dev/null
+++ b/nixos/doc/manual/configuration/overlayfs.section.md
@@ -0,0 +1,27 @@
+# Overlayfs {#sec-overlayfs}
+
+NixOS offers a convenient abstraction to create both read-only as well writable
+overlays.
+
+```nix
+fileSystems = {
+  "/writable-overlay" = {
+    overlay = {
+      lowerdir = [ writableOverlayLowerdir ];
+      upperdir = "/.rw-writable-overlay/upper";
+      workdir = "/.rw-writable-overlay/work";
+    };
+    # Mount the writable overlay in the initrd.
+    neededForBoot = true;
+  };
+  "/readonly-overlay".overlay.lowerdir = [
+    writableOverlayLowerdir
+    writableOverlayLowerdir2
+  ];
+};
+```
+
+If `upperdir` and `workdir` are not null, they will be created before the
+overlay is mounted.
+
+To mount an overlay as read-only, you need to provide at least two `lowerdir`s.