diff --git a/flake.lock b/flake.lock index 7d8a4f7..98f29c6 100644 --- a/flake.lock +++ b/flake.lock @@ -389,11 +389,11 @@ ] }, "locked": { - "lastModified": 1771519029, - "narHash": "sha256-H59Qf82wv5kBXVoyXsmUKW+9J3o8FqgY4uKaLdsLdLg=", + "lastModified": 1771531206, + "narHash": "sha256-1R3Wx6KUkMb4x4E5UOhW9p6rqiexzSGGWxZqSHqW5n0=", "owner": "nix-community", "repo": "home-manager", - "rev": "167e0b6837115e672ec5f58e2b0ea39093abe807", + "rev": "91be7cce763fa4022c7cf025a71b0c366d1b6e77", "type": "github" }, "original": { @@ -555,11 +555,11 @@ }, "nixpkgs-edge": { "locked": { - "lastModified": 1771529647, - "narHash": "sha256-jg/CvWdnL3ZZhx58j8g1WDXJHALqiutiwnSyP4zPLj8=", + "lastModified": 1771539422, + "narHash": "sha256-TerWaqclKBZY7mWBEgA+7uwjSmpuWQ4QaOH7MTUkFkI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "64a253ac18f1496577a30251a06c3871bdcaaa99", + "rev": "c4c6a8dea4a441e4cb2bdb5bc4266a6a9cce3859", "type": "github" }, "original": { @@ -906,11 +906,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1771428844, - "narHash": "sha256-rTzo6bZEsdT7yHUZ0B4BYe32XQZzm8SiWKvWLJnxerE=", + "lastModified": 1771536203, + "narHash": "sha256-ffSQmf7RZqCShzUkK4VlROGsBZy9tgKBYRQ5XQD0PiM=", "owner": "nix-community", "repo": "stylix", - "rev": "801843d10e9e22d7a00f660d069e2de70aa2980a", + "rev": "ec4d1ce9da22da964cef8a77795dc32011ebbb55", "type": "github" }, "original": { diff --git a/nixos/hosts/EDI/configuration.nix b/nixos/hosts/EDI/configuration.nix index ab62e21..0d58a61 100644 --- a/nixos/hosts/EDI/configuration.nix +++ b/nixos/hosts/EDI/configuration.nix @@ -42,9 +42,8 @@ virtualisation.spiceUSBRedirection.enable = true; - services.displayManager.sddm = { + services.displayManager.plasma-login-manager = { enable = true; - wayland.enable = true; }; services.displayManager.defaultSession = "plasma"; diff --git a/nixos/hosts/GLaDOS/configuration.nix b/nixos/hosts/GLaDOS/configuration.nix index 3ae30f8..855c5f7 100644 --- a/nixos/hosts/GLaDOS/configuration.nix +++ b/nixos/hosts/GLaDOS/configuration.nix @@ -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!" ''; };