nixos-config/misc/luks-single.sh

14 lines
353 B
Bash
Raw Normal View History

2021-06-28 01:20:04 +00:00
#!/usr/bin/env bash
2021-06-28 03:45:04 +00:00
set -ex
2021-06-28 01:20:04 +00:00
2021-06-28 03:45:04 +00:00
cryptsetup -y -v luksFormat "/dev/disk/by-partlabel/_root"
cryptsetup --allow-discards open "/dev/disk/by-partlabel/_root" cryptroot
2021-06-28 01:20:04 +00:00
mkfs.btrfs -f -L_root /dev/mapper/cryptroot
mount /dev/disk/by-label/_root /mnt -o discard,compress=zstd:1
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/nix
mkdir /mnt/boot