Impermanence: Difference between revisions
imported>Klaymore Started page, wrote a ton |
imported>Klaymore Home Manager module uses Fuse mounts not bind mounts. Added more Plasma files to persist |
||
| Line 1: | Line 1: | ||
Impermanence in NixOS is where your root directory gets wiped every reboot (such as by mounting a tmpfs to /). Such a setup is possible because NixOS only needs <code>/boot</code> and <code>/nix</code> in order to boot, all other system files are simply links to files in <code>/nix</code>. <code>/boot</code> and <code>/nix</code> still need to be stored on a hard drive or SSD. | Impermanence in NixOS is where your root directory gets wiped every reboot (such as by mounting a tmpfs to /). Such a setup is possible because NixOS only needs <code>/boot</code> and <code>/nix</code> in order to boot, all other system files are simply links to files in <code>/nix</code>. <code>/boot</code> and <code>/nix</code> still need to be stored on a hard drive or SSD. | ||
Example hardwareconfiguration.nix settings: | Example <code>hardwareconfiguration.nix</code> settings: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
fileSystems."/" = | fileSystems."/" = | ||
| Line 60: | Line 60: | ||
You can just make a home partition on a drive and mount it as normal, so everything in <code>/home</code> or <code>/home/username</code> will be persisted. If you want your home to be impermanent as well, then mount it on tmpfs the same way as root. | You can just make a home partition on a drive and mount it as normal, so everything in <code>/home</code> or <code>/home/username</code> will be persisted. If you want your home to be impermanent as well, then mount it on tmpfs the same way as root. | ||
For persisting files in your home, you could simply use [https://github.com/nix-community/home-manager Home Manager] like normal. However, then files are stored read-only in the Nix store. In order to persist files while still being | For persisting files in your home, you could simply use [https://github.com/nix-community/home-manager Home Manager] like normal. However, then files are stored read-only in the Nix store. In order to persist files while still being writable, you can use the [https://github.com/nix-community/impermanence Home Manager Impermanence module]. It will fuse mount and link files as necessary. | ||
| Line 118: | Line 118: | ||
allowOther = true; | allowOther = true; | ||
directories = [ | directories = [ | ||
".config/gtk-3.0" # | ".config/gtk-3.0" # fuse mounted to /home/$USERNAME/.config/gtk-3.0 | ||
".config/gtk-4.0" | ".config/gtk-4.0" | ||
".config/KDE" | ".config/KDE" | ||
| Line 125: | Line 125: | ||
".config/xsettingsd" | ".config/xsettingsd" | ||
".kde" | ".kde" | ||
".local/share/baloo" | |||
".local/share/dolphin" | |||
".local/share/kactivitymanagerd" | |||
".local/share/kate" | |||
".local/share/klipper" | |||
".local/share/konsole" | |||
".local/share/kscreen" | |||
".local/share/kwalletd" | |||
".local/share/kxmlgui5" | |||
".local/share/RecentDocuments" | |||
".local/share/sddm" | |||
]; | ]; | ||
files = [ | files = [ | ||
| Line 180: | Line 192: | ||
".config/user-dirs.dirs" | ".config/user-dirs.dirs" | ||
".config/user-dirs.locale" | ".config/user-dirs.locale" | ||
".local/share/krunnerstaterc" | |||
".local/share/user-places.xbel" | |||
".local/share/user-places.xbel.bak" | |||
".local/share/user-places.xbel.tbcache" | |||
]; | ]; | ||
}; | }; | ||