Skip to content

Instantly share code, notes, and snippets.

@gallexme
gallexme / 0-nixos-tmpfs.md
Last active July 11, 2023 12:26 — forked from lheckemann/0-nixos-tmpfs.md
NixOS: switch-root to tmpfs

Build a NixOS config, copy it to a tmpfs, and enter it, shutting the running userspace (but not the kernel) down. This can be useful e.g. for repartitioning the system or switching it to a new zfs pool, without the need for extra installation media, and is a little faster than most other volatile system methods (e.g. kexec, classic USB or CD installer), since the store is in RAM and uncompressed right from the get-go. It also copies the SSH host keys from the building system to maintain the chain of trust in a remote system.