From 4210004147784c3c03c96deb5ee538843f1b8af1 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 4 Nov 2025 23:16:03 -0600 Subject: [PATCH] test: impermanence --- systems/ceres/config/filesystem.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/systems/ceres/config/filesystem.nix b/systems/ceres/config/filesystem.nix index 99b15e4..dadfee1 100755 --- a/systems/ceres/config/filesystem.nix +++ b/systems/ceres/config/filesystem.nix @@ -48,29 +48,29 @@ in }; boot.initrd.postResumeCommands = lib.mkAfter '' - mkdir -p /mnt - mount -o subvol=/ /dev/disk/by-label/root /mnt + mkdir -p /btrfs_tmp + mount -o subvol=/ /dev/disk/by-label/root /btrfs_tmp - if [[ -e /mnt/@ ]]; then - mkdir -p /mnt/@old_roots - timestamp=$(date --date="@$(stat -c %Y /mnt/@)" "+%Y-%m-%d_%H:%M:%S") - mv /mnt/@ "/mnt/@old_roots/$timestamp" + if [[ -e /btrfs_tmp/@ ]]; then + mkdir -p /btrfs_tmp/@old_roots + 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() { IFS=$'\n' for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/mnt/$i" + delete_subvolume_recursively "/btrfs_tmp/$i" done btrfs subvolume delete "$1" } - for i in $(find /mnt/@old_roots/ -maxdepth 1 -mtime +30); do + for i in $(find /btrfs_tmp/@old_roots/ -maxdepth 1 -mtime +30); do delete_subvolume_recursively "$i" done - btrfs subvolume create /mnt/@ - umount /mnt + btrfs subvolume create /btrfs_tmp/@ + umount /btrfs_tmp ''; environment.persistence."/persistent" = {