From b85f390dbf3cea5b81e2eddb97870327e4ae22dd Mon Sep 17 00:00:00 2001 From: Perchun Pak Date: Wed, 22 Apr 2026 11:03:40 +0200 Subject: [PATCH] Update for 26.05 --- final/configuration.nix | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/final/configuration.nix b/final/configuration.nix index 3248d68..ec3f556 100644 --- a/final/configuration.nix +++ b/final/configuration.nix @@ -19,6 +19,8 @@ extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. }; + # if you get an error about postDeviceCommands no longer available (26.05 or + # unstable), read further boot.initrd.postDeviceCommands = lib.mkAfter '' mkdir /btrfs_tmp mount /dev/root_vg/root /btrfs_tmp @@ -43,6 +45,50 @@ btrfs subvolume create /btrfs_tmp/root umount /btrfs_tmp ''; + # only uncomment this if you are on 26.05 or nixos-unstable, and remove the previous block + # boot.initrd.systemd = { + # initrdBin = with pkgs; [ + # btrfs-progs + # coreutils + # util-linux + # findutils + # ]; + # + # services.prune-subvolumes = { + # requiredBy = [ "initrd.target" ]; + # before = [ "local-fs-pre.target" ]; + # after = [ + # "initrd-root-device.target" + # "systemd-hibernate-resume.service" + # ]; + # unitConfig.DefaultDependencies = false; + # serviceConfig.Type = "oneshot"; + # script = '' + # mkdir /btrfs_tmp + # mount /dev/mapper/root_vg-root /btrfs_tmp + # if [[ -e /btrfs_tmp/root ]]; then + # 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" + # fi + # + # 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" + # } + # + # for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + # delete_subvolume_recursively "$i" + # done + # + # btrfs subvolume create /btrfs_tmp/root + # umount /btrfs_tmp + # ''; + # }; + # }; fileSystems."/persist".neededForBoot = true; environment.persistence."/persist/system" = {