content: nixos-btrfs: Add section about UEFI (+ LUKS) installation

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-11-05 23:23:21 +01:00
parent e37fcec272
commit 6469447c54
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A

View file

@ -11,7 +11,7 @@ date: 2023-10-14T00:15:29+02:00
$ fdisk /dev/vdX
fdisk> o
fdisk> n
# enter, enter, enter, enter
# <enter>, <enter>, <enter>
# primary partition, number 1, from sector 2048 to end
fdisk> w
```
@ -45,6 +45,57 @@ $ mount -o noatime,compress=zstd,subvol=@nix /dev/disk/by-uuid/<uuid> /mnt/nix
$ mount -o noatime,compress=zstd,subvol=@log /dev/disk/by-uuid/<uuid> /mnt/var/log
```
## UEFI, ESP + single partition
### first, create a new GPT partition table and two partitions
```shell {lineanchors=list}
$ fdisk /dev/sdX
fdisk> g
fdisk> n
# <enter>, <enter>, +512M
# primary partition, number 1, from sector 2048 with size 512MiB
fdisk> w
```
### if the root partition should be encrypted
don't forget proper [drive preparation](https://wiki.archlinux.org/title/Dm-crypt/Drive_preparation)!
```shell {lineanchors=list}
$ cryptsetup -y -v luksFormat /dev/sdX2
$ cryptsetup open /dev/sdX2 nixos-root
```
### create the filesystems
```shell {lineanchors=list}
$ mkfs.vfat -F32 -n nixos-boot /dev/sdX1
$ mkfs.btrfs -L nixos /dev/sdX2 # or /dev/mapper/nixos-root if encrypted
```
### create all the subvolumes
```shell {lineanchors=list}
$ mount /dev/sdX2 /mnt # or /dev/mapper/nixos-root
$ btrfs subvolume create /mnt/@
$ btrfs subv cr /mnt/@home
$ btrfs subv cr /mnt/@nix
$ btrfs subv cr /mnt/@log
$ umount /mnt
```
### Mount Btrfs again, now properly with the subvolumes
```shell {lineanchors=list}
$ mount -o noatime,subvol=@ /dev/disk/by-uuid/<uuid> /mnt # or /dev/mapper/nixos-root
$ mkdir -p /mnt/{boot,home,nix,var/log}
$ mount /dev/disk/by-uuid/<esp-uuid> /mnt/boot
$ mount -o subvol=@home /dev/disk/by-uuid/<uuid> /mnt/home
$ mount -o noatime,compress=zstd,subvol=@nix /dev/disk/by-uuid/<uuid> /mnt/nix
$ mount -o noatime,compress=zstd,subvol=@log /dev/disk/by-uuid/<uuid> /mnt/var/log
```
## rest of the installation
### generate the initial NixOS system config