Skip to content

Commit

Permalink
chore!: 2024-02-10 19:14:53 +0100
Browse files Browse the repository at this point in the history
  • Loading branch information
trueNAHO committed Feb 10, 2024
1 parent 801ea32 commit 06a0c2d
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions modules/impermanence/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,37 @@
lib.mkIf
cfg.btrfsSnapshots.enable
(lib.mkAfter ''
set -e
(
set -e
# TODO: remove
set +x
# TODO: remove
set +x
btrfs_subvolume_delete_recursive() {
btrfs subvolume list -o "$1" |
awk '{ print $NF }' |
while read -r subvolume; do
btrfs_subvolume_delete_recursive "$mount_point/$subvolume"
done
btrfs_subvolume_delete_recursive() {
btrfs subvolume list -o "$1" |
awk '{ print $NF }' |
while read -r subvolume; do
btrfs_subvolume_delete_recursive "$mount_point/$subvolume"
done
btrfs subvolume delete "$1"
}
btrfs subvolume delete "$1"
}
mount_point=/.erase_your_darlings
mount_point=/.erase_your_darlings
mkdir --parent "$mount_point"
mount "${cfg.btrfsSnapshots.filesystemRoot}" "$mount_point"
mkdir --parent "$mount_point"
mount "${cfg.btrfsSnapshots.filesystemRoot}" "$mount_point"
trap 'umount "$mount_point"; rmdir "$mount_point"' EXIT
trap 'umount "$mount_point" && rmdir "$mount_point"' EXIT
btrfs_subvolume_delete_recursive \
"$mount_point/${cfg.btrfsSnapshots.snapshot.root}"
btrfs_subvolume_delete_recursive \
"$mount_point/${cfg.btrfsSnapshots.snapshot.root}"
btrfs \
subvolume \
create \
"$mount_point/${cfg.btrfsSnapshots.snapshot.root}"
btrfs \
subvolume \
create \
"$mount_point/${cfg.btrfsSnapshots.snapshot.root}"
)
'');

environment.persistence.${cfg.path}.directories = [
Expand Down

0 comments on commit 06a0c2d

Please sign in to comment.