1# `/etc` via overlay filesystem {#sec-etc-overlay}
2
3::: {.note}
4This is experimental and requires a kernel version >= 6.6 because it uses
5new overlay features and relies on the new mount API.
6:::
7
8Instead of using a custom perl script to activate `/etc`, you activate it via an
9overlay filesystem:
10
11```nix
12{ system.etc.overlay.enable = true; }
13```
14
15Using an overlay has two benefits:
16
171. it removes a dependency on perl
182. it makes activation faster (up to a few seconds)
19
20By default, the `/etc` overlay is mounted writable (i.e. there is a writable
21upper layer). However, you can also mount `/etc` immutably (i.e. read-only) by
22setting:
23
24```nix
25{ system.etc.overlay.mutable = false; }
26```
27
28The overlay is atomically replaced during system switch. However, files that
29have been modified will NOT be overwritten. This is the biggest change compared
30to the perl-based system.
31
32If you manually make changes to `/etc` on your system and then switch to a new
33configuration where `system.etc.overlay.mutable = false;`, you will not be able
34to see the previously made changes in `/etc` anymore. However the changes are
35not completely gone, they are still in the upperdir of the previous overlay in
36`/.rw-etc/upper`.