configure nix

This commit is contained in:
Adithya 2023-04-26 22:56:43 +05:30
parent ad22d6149e
commit 0d07d230c0
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
2 changed files with 29 additions and 0 deletions

View file

@ -8,6 +8,8 @@
]; ];
auto-optimise-store = true; auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" "auto-allocate-uids" "cgroups" "ca-derivations" ]; experimental-features = [ "nix-command" "flakes" "auto-allocate-uids" "cgroups" "ca-derivations" ];
auto-allocate-uids = true;
use-cgroups = true;
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
} }

View 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
'';
}