i migrated from a stock nixos deployment to an amnesiac one, without creating a totally new filesystem/install (i.e. without “deleting my entire root”). right now you have a fs mounted to /. after impermanence, you’ll mount that fs to /nix and bind-mount things from /nix/persist back to parts of the rootfs. if you can access the fs offline, then you can move /nix/* up to the root of that fs, mount it at /nix instead of / during boot, and now your system’s amnesiac. all your old state will be in /nix/… instead of where anything might expect it. move that to /nix/persist, and then start adding impermanence entries for the state you want to persist.
you can actually do this online if you’re careful (cp /nix/* up to /, then edit the fileSystems entry so that your media is mounted at /nix, nixos-rebuild switch, cp again to make sure the new generation is in both places, reboot, delete the old store which should be visible at /nix/nix/store, then organize the persisted data as above).
safety tips are:
- don’t delete any files until you’re sure they’re not needed.
- if you’re okay working offline, then prefer
mv
ing stuff into where it’s supposed to be and just undoing that if it doesn’t boot. - if you have to work online, then don’t move anything but copy it instead, and you’ll always be able to reboot into older, known-good generations (assuming /boot is on its own fs).
- take notes about where you mv stuff so that you know how to undo things if you go wrong.
- join us in the #impermanence:nixos.org Matrix channel if you’re not already there :)