cryptsetup luksFormat -c aes-xts-plain64 -h sha512 -S 1 -s 512 -i 5000 --use-random --type luks2 --pbkdf argon2id /dev/nvme0n1p2

cryptsetup open --allow-discards /dev/nvme0n1p2 cryptlvm

pvcreate /dev/mapper/cryptlvm

vgcreate vg /dev/mapper/cryptlvm

lvcreate -L 8G vg -n swap

lvcreate -l 100%FREE vg -n root

mkfs.btrfs /dev/vg/root

mkfs.btrfs /dev/vg/root

mkfs.fat -F32 /dev/nvme0n1p1

btrfs_options=rw,noatime,ssd,compress-force=zstd:2,space_cache=v2,discard=async

mount -o $btrfs_options,subvolid=5 /dev/vg/root /mnt

btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home

umount /mnt

mkdir /mnt/{home,btrfs_pool,efi}

mount -o $btrfs_options,subvol=@home /dev/vg/root /mnt/home
mount -o $btrfs_options,subvolid=5 /dev/vg/root /mnt/btrfs_pool

chmod 700 /mnt/btrfs_pool

mount /dev/nvme0n1p1 /mnt/efi

swapon /dev/vg/swap

pacstrap /mnt base base-devel linux linux-headers linux-firmware mkinitcpio lvm2 nano dhcpcd wpa_supplicant btrfs-progs sudo efibootmgr efitools git wget curl

genfstab -U /mnt >> /mnt/etc/fstab