This commit is contained in:
2026-07-03 20:14:10 +01:00
parent 1ad416c69e
commit 6bd0fa9d6e
3 changed files with 39 additions and 37 deletions
+37 -37
View File
@@ -8,43 +8,43 @@ in
{ {
boot.initrd.supportedFilesystems = [ "btrfs" ]; boot.initrd.supportedFilesystems = [ "btrfs" ];
boot.initrd.systemd.services.rollback-root = { # boot.initrd.systemd.services.rollback-root = {
description = "Rollback btrfs root subvolume"; # description = "Rollback btrfs root subvolume";
wantedBy = [ "initrd.target" ]; # wantedBy = [ "initrd.target" ];
after = [ "systemd-cryptsetup@.service" ]; # after = [ "systemd-cryptsetup@.service" ];
before = [ "sysroot.mount" ]; # before = [ "sysroot.mount" ];
unitConfig.DefaultDependencies = "no"; # unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot"; # serviceConfig.Type = "oneshot";
script = '' # script = ''
mkdir -p /btrfs_tmp # mkdir -p /btrfs_tmp
mount ${rootDisk} /btrfs_tmp # mount ${rootDisk} /btrfs_tmp
#
# Ensure the old_roots directory exists # # Ensure the old_roots directory exists
mkdir -p /btrfs_tmp/old_roots # mkdir -p /btrfs_tmp/old_roots
#
if [[ -e /btrfs_tmp/root ]]; then # if [[ -e /btrfs_tmp/root ]]; then
timestamp=$(date +%Y-%m-%d_%H-%M-%S) # timestamp=$(date +%Y-%m-%d_%H-%M-%S)
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" # mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi # fi
#
delete_subvolume_recursively() { # delete_subvolume_recursively() {
IFS=$'\n' # IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9 -d ' '); do # for i in $(btrfs subvolume list -o "$1" | cut -f 9 -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i" # delete_subvolume_recursively "/btrfs_tmp/$i"
done # done
btrfs subvolume delete "$1" # btrfs subvolume delete "$1"
} # }
#
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +7); do # for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +7); do
# Don't delete the old_roots directory itself # # Don't delete the old_roots directory itself
if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi # if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi
delete_subvolume_recursively "$i" # delete_subvolume_recursively "$i"
done # done
#
btrfs subvolume create /btrfs_tmp/root # btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp # umount /btrfs_tmp
''; # '';
}; # };
# fileSystems."/" = { # fileSystems."/" = {
# device = rootDisk; # device = rootDisk;
+1
View File
@@ -37,6 +37,7 @@
".local/state/wireplumber" ".local/state/wireplumber"
".mozilla/firefox" ".mozilla/firefox"
".ssh" ".ssh"
".gemini"
".steam" ".steam"
".minecraft" ".minecraft"
"Code" "Code"
+1
View File
@@ -32,6 +32,7 @@
enable = true; enable = true;
wayland.enable = true; wayland.enable = true;
theme = "maya"; theme = "maya";
package = pkgs-unstable.kdePackages.sddm;
}; };
autoLogin.enable = true; autoLogin.enable = true;
autoLogin.user = "chris"; autoLogin.user = "chris";