
When one heard the word "impermanence", you may think of the Buddhist doctorine of ever lasting cycles of change, and the reincarnation from one state of being to another.
But that's not what we're talking out….kinda.
We're talking about NixOS impermanaence!
Impermanence allows you to have a fresh, clean slate of NixOS upon each reboot, while retaining data you which to persist between reboots. This goes a little bit above and beyond successive generations of NixOS changes, although impermanance greatly complements NixOS's immutability. And that brings us to our second word in our Buddhist meditation - immutability.
NixOS can be both immutable and impermanent! Why would you want to do this?
For a number of different reasons.
- You can easily tinker with much larger operating systems software and concepts beyond just nix dev shells.
You have just made an oops, and need to easily revert everything you did.
But last and not least…
- You like the new computer smell. We all do. We all do.
Upon setting up impermanance, you'll find your system boots blazingly fast as there is no cruft, and everything is just pullef from the nix store, as a completely fresh install. Although, you can also garbage collect the store, and have it install everything off Nixkgs from the Internet. Either way is up to you.
Setting it up is fairly straight foward. You can either have the root filesystem stored on tmpfs or a filesystem of your choice - including ZFS or BTRFS. I've choosen BTRFS using LVM volumes which works well, and allows you to use LUKS for disk encryption.
I based my setup on vimjoyer's excellent basic BTFS example with some of my own modifications to the super-paranoid, which I will publish is a subsequent post. While this is for BTRFS, there are also ZFS tutorials available, and it's trivial to change the backing filesystem. Below are some resources that I used to do this. Namaste!