configure nix
This commit is contained in:
parent
ad22d6149e
commit
0d07d230c0
2 changed files with 29 additions and 0 deletions
|
@ -8,6 +8,8 @@
|
|||
];
|
||||
auto-optimise-store = true;
|
||||
experimental-features = [ "nix-command" "flakes" "auto-allocate-uids" "cgroups" "ca-derivations" ];
|
||||
auto-allocate-uids = true;
|
||||
use-cgroups = true;
|
||||
};
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
}
|
||||
|
|
27
hosts/skipper/rollback.nix
Normal file
27
hosts/skipper/rollback.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib, ... }: {
|
||||
boot.initrd.postDeviceCommands = lib.mkBefore ''
|
||||
mkdir -p /mnt
|
||||
mount -o subvol=/ /dev/vg0/system /mnt
|
||||
|
||||
btrfs subvolume list -o /mnt |
|
||||
cut -f9 -d' ' |
|
||||
while read subvolume; do
|
||||
echo "deleting /$subvolume subvolume..."
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done &&
|
||||
echo "deleting /root subvolume..." &&
|
||||
btrfs subvolume delete "/mnt/@root"
|
||||
|
||||
|
||||
echo "restoring blank /root subvolume..."
|
||||
btrfs subvolume snapshot /mnt/@root-blank /mnt/@root
|
||||
|
||||
echo "deleting /home subvolume..."
|
||||
btrfs subvolume delete /mnt/@home
|
||||
|
||||
echo "restoring blank /home subvolume..."
|
||||
btrfs subvolume snapshot /mnt/@home-blank /mnt/@home
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue