32 lines
694 B
Bash
32 lines
694 B
Bash
# Assuming /dev/sda is the target disk
|
|
parted /dev/sda -- mklabel gpt
|
|
|
|
parted /dev/sda -- mkpart ESP fat32 1MiB 513MiB
|
|
parted /dev/sda -- set 1 boot on
|
|
|
|
parted /dev/sda -- mkpart primary ext4 513MiB 100%
|
|
|
|
mkfs.fat -F32 -n BOOT /dev/sda1
|
|
mkfs.ext4 /dev/sda2
|
|
|
|
mount /dev/sda2 /mnt
|
|
cryptsetup luksFormat /dev/sda2
|
|
cryptsetup open /dev/sda2 root
|
|
mkfs.ext4 /dev/mapper/root
|
|
mount /dev/mapper/root /mnt
|
|
|
|
mkdir -p /mnt/boot
|
|
mount /dev/sda1 /mnt/boot
|
|
|
|
mkdir -p /mnt/etc/nixos
|
|
git clone https://git.luke-else.co.uk/luke-else/nixos-config.git /mnt/etc/nixos
|
|
|
|
nixos-generate-config --root /mnt
|
|
|
|
nixos-install --flake /mnt/etc/nixos#vm
|
|
|
|
passwd
|
|
|
|
reboot
|
|
|
|
# sudo nixos-rebuild switch --flake ~/nixos-config#vm |