disko on new nvme drive
Got a new nvme drive to replace my failing one. Decided to try out disko with btrfs and LUKS. It was super easy. I copy pasted the example from https://haseebmajid.dev/posts/2024-07-30-how-i-setup-btrfs-and-luks-on-nixos-using-disko/ with the following changes:
- removed impermenance stuff, not interested in it yet
- removed yubikey integration, I will just type my password for now
- updated to point to /dev/nvme1n1
Then I just ran this command and it formatted. Pretty scary how it just does all this without confirmation of changes it will make:
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disk-config.nix
I then followed the instructions at https://github.com/nix-community/disko/blob/v1.12.0/docs/quickstart.md but tweaked it to use flakes in my dotfiles which I cloned in. So I compared the generated hardware-configuration and updated it to keep references to my spinning disk mounts.
I then copied the disk-config in and included it + other minor changes at commit https://github.com/keegancsmith/dotfiles/commit/386578240bb9b2e4eb67b31906d166294e19e8b3
nixos-install --flake .#habitat
The setup didn't work first try because the device name for my ethernet port was wrong. I had to go back into the livedisk and mount everything to re-apply the config change.
cryptsetup luksOpen /dev/nvme1n1p2 my_encrypted_volume
mount -t btrfs -o subvol=root /dev/mapper/my_encrypted_volume /mnt
mount -t btrfs -o subvol=nix /dev/mapper/my_encrypted_volume /mnt/nix
mount -t btrfs -o subvol=home /dev/mapper/my_encrypted_volume /mnt/home
mount -t btrfs -o subvol=log /dev/mapper/my_encrypted_volume /mnt/var/log
mount /dev/nvme1n1p1 /mnt/boot
cd /mnt/etc/nixos/dotfiles/
nix-shell -p git
nixos-install --flake .#habitat
Don't know why I did nixos-install, I should of entered and done rebuild. Oh well.