update flake lock, update btrfs wipe GLaDOS, replace SDDM with plasma launch on EDI and GLaDOS
This commit is contained in:
parent
c6d25885c1
commit
68a7950b5e
3 changed files with 61 additions and 32 deletions
|
|
@ -33,9 +33,8 @@
|
|||
gparted
|
||||
];
|
||||
|
||||
services.displayManager.sddm = {
|
||||
services.displayManager.plasma-login-manager = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
};
|
||||
|
||||
services.displayManager.defaultSession = "plasma";
|
||||
|
|
@ -76,32 +75,63 @@
|
|||
# };
|
||||
};
|
||||
boot = {
|
||||
# Nuke root AND home subvolumes on every boot
|
||||
initrd.systemd.services.wipe-my-fs = {
|
||||
requires = ["dev-mapper-nvme_crypted.device"];
|
||||
after = ["dev-mapper-nvme_crypted.device"];
|
||||
initrd.systemd.services.rollback = {
|
||||
description = "Rollback BTRFS root subvolume to a pristine state";
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = ["initrd.target"];
|
||||
after = ["systemd-cryptsetup@nvme_crypted.service"];
|
||||
before = ["sysroot.mount"];
|
||||
|
||||
script = ''
|
||||
echo "mounting btrfs volume to tmp..."
|
||||
mkdir -p /btrfs_tmp
|
||||
mount /dev/mapper/cryptroot /btrfs_tmp
|
||||
mount /dev/mapper/nvme_crypted /btrfs_tmp
|
||||
echo "mount successful!"
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
echo "copying root to backup..."
|
||||
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"
|
||||
echo "copy complete!"
|
||||
fi
|
||||
|
||||
# Nuke and recreate root
|
||||
delete_subvolume_recursively /btrfs_tmp/root
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
if [[ -e /btrfs_tmp/home ]]; then
|
||||
echo "copying home to backup..."
|
||||
mkdir -p /btrfs_tmp/old_homes
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/home)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/home "/btrfs_tmp/old_homes/$timestamp"
|
||||
"copy complete!"
|
||||
fi
|
||||
|
||||
# Nuke and recreate home (wipes /home — but we restore via impermanence)
|
||||
delete_subvolume_recursively /btrfs_tmp/home
|
||||
btrfs subvolume create /btrfs_tmp/home
|
||||
|
||||
umount /btrfs_tmp
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
echo "recursively deleting root subvolumes older than five days..."
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +5); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
echo "subvolumes deleted!"
|
||||
|
||||
echo "recursively deleting home subvolumes older than five days..."
|
||||
for i in $(find /btrfs_tmp/old_homes/ -maxdepth 1 -mtime +5); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
echo "subvolumes deleted!"
|
||||
|
||||
echo "creating new root and home subvolumes..."
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
btrfs subvolume create /btrfs_tmp/home
|
||||
echo "unmounting btrfs temporary mount..."
|
||||
umount /btrfs_tmp
|
||||
echo "disk clear complete!"
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue