fix(impermanence): work aorund docker and systemd subvols

This commit is contained in:
buffet 2023-05-02 12:15:58 +02:00
parent b733481b2e
commit 35fd160476
2 changed files with 12 additions and 1 deletions

View file

@ -23,6 +23,12 @@
options = ["subvol=@"]; options = ["subvol=@"];
}; };
fileSystems."/old" = {
device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d";
fsType = "btrfs";
options = ["subvol=@old"];
};
fileSystems."/persist" = { fileSystems."/persist" = {
device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d"; device = "/dev/disk/by-uuid/d2c87f01-cdb7-4871-ae9d-c3a843e1199d";
fsType = "btrfs"; fsType = "btrfs";

View file

@ -14,9 +14,12 @@
directories = [ directories = [
"/etc/NetworkManager/system-connections" "/etc/NetworkManager/system-connections"
"/etc/nixos" "/etc/nixos"
"/root/.ssh"
"/srv" "/srv"
"/var/lib/bluetooth" "/var/lib/bluetooth"
"/var/lib/docker"
"/var/lib/machines" "/var/lib/machines"
"/var/lib/portables"
"/var/log" "/var/log"
]; ];
@ -69,9 +72,11 @@
echo "recreating root subvolume..." echo "recreating root subvolume..."
mkdir -p /mnt mkdir -p /mnt
mount ${config.fileSystems."/".device} /mnt mount ${config.fileSystems."/".device} /mnt
btrfs subvolume delete /mnt/@ btrfs subvolume delete /mnt/@old
mv /mnt/@ /mnt/@old
btrfs subvolume create /mnt/@ btrfs subvolume create /mnt/@
umount /mnt umount /mnt
echo "done recreating subvolume"
''; '';
}; };