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{ 13 system.etc.overlay.enable = true; 14} 15``` 16 17Using an overlay has two benefits: 18 191. it removes a dependency on perl 202. it makes activation faster (up to a few seconds) 21 22By default, the `/etc` overlay is mounted writable (i.e. there is a writable 23upper layer). However, you can also mount `/etc` immutably (i.e. read-only) by 24setting: 25 26```nix 27{ 28 system.etc.overlay.mutable = false; 29} 30``` 31 32The overlay is atomically replaced during system switch. However, files that 33have been modified will NOT be overwritten. This is the biggest change compared 34to the perl-based system. 35 36If you manually make changes to `/etc` on your system and then switch to a new 37configuration where `system.etc.overlay.mutable = false;`, you will not be able 38to see the previously made changes in `/etc` anymore. However the changes are 39not completely gone, they are still in the upperdir of the previous overlay in 40`/.rw-etc/upper`.