test: impermanence

This commit is contained in:
Nick 2025-11-05 02:01:34 -06:00
parent e81fd3c97a
commit f5d5950e0a

View file

@ -12,7 +12,7 @@ in
"/" = {
device = "/dev/disk/by-uuid/00d712c2-5883-4409-afd8-514886f4e824";
fsType = "btrfs";
options = [ "subvol=root" ];
options = [ "subvol=@" ];
};
"/nix" = {
@ -42,12 +42,12 @@ in
boot.initrd.postResumeCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount -o subvolid=5 /dev/sdb2 /btrfs_tmp
mount -o subvolid=5 /dev/sda2 /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
if [[ -e /btrfs_tmp/@ ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/@ "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
@ -62,7 +62,7 @@ in
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
btrfs subvolume create /btrfs_tmp/@
umount /btrfs_tmp
'';