Generalize and split up more files
This commit is contained in:
parent
9c03712908
commit
13d24f42ea
27 changed files with 161 additions and 156 deletions
|
@ -3,38 +3,5 @@
|
|||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernel.sysctl."vm.max_map_count" = 2147483642;
|
||||
|
||||
initrd = {
|
||||
systemd = {
|
||||
enable = true;
|
||||
services.root-reset = {
|
||||
description = "Reset BTRFS root and snapshot last boot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
after = [ "dev-nixos-root.device" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /mnt
|
||||
mount /dev/nixos/root /mnt
|
||||
|
||||
if [[ -e /mnt/@prev ]]; then
|
||||
btrfs subvolume delete /mnt/@prev
|
||||
fi
|
||||
|
||||
btrfs subvolume snapshot /mnt/@ /mnt/@prev
|
||||
|
||||
btrfs subvolume list -o /mnt/@ | cut -f9 -d' ' | while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done
|
||||
|
||||
btrfs subvolume delete /mnt/@
|
||||
btrfs subvolume create /mnt/@
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue