diff --git a/modules/system/impermanence.nix b/modules/system/impermanence.nix index 790a469..04cf1b7 100644 --- a/modules/system/impermanence.nix +++ b/modules/system/impermanence.nix @@ -19,6 +19,21 @@ fi if [ -d /mnt/root ]; then + if [ -d /mnt/root-previous ]; then + btrfs subvolume delete /mnt/root-previous + fi + btrfs subvolume snapshot /mnt/root /mnt/root-previous + + while true; do + subvols="$(btrfs subvolume list -o /mnt/root | awk '{print $9}')" + if [ -z "$subvols" ]; then + break + fi + for subvol in $subvols; do + btrfs subvolume delete "/mnt/$subvol" + done + done + btrfs subvolume delete /mnt/root fi @@ -34,8 +49,11 @@ "/etc/nixos" "/etc/ssh" "/etc/cups" + "/var/lib/bluetooth" "/var/lib/cups" + "/var/lib/fprint" "/var/lib/libvirt" + "/var/lib/NetworkManager" "/var/lib/secureboot" "/var/lib/tailscale" "/var/lib/systemd"