Skip to content

Instantly share code, notes, and snippets.

@piyoki
Forked from nasirhm/btrfs-nixos-install.sh
Created June 2, 2023 08:54
Show Gist options
  • Save piyoki/83c33a057739aa37556ba1c18837fe44 to your computer and use it in GitHub Desktop.
Save piyoki/83c33a057739aa37556ba1c18837fe44 to your computer and use it in GitHub Desktop.
nixos install (boot + btrfs root + LUKS setup)
mkfs.vfat -n BOOT /dev/sda3
mkfs.btrfs -L root /dev/sda1
cryptsetup luksFormat /dev/sda1
# Enter the Password.
cryptsetup luksOpen /dev/sda1 enc-pv
# After Opening the Disk, Open Gparted and Format /dev/sda1 to btrfs for the btrfs logic block.
# Add a label to /dev/sda1 too as nixos
mount -t btrfs /dev/disk/by-label/nixos /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o subvol=nixos /dev/disk/by-label/nixos /mnt/
btrfs subvolume create /mnt/var
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/tmp
mkdir /mnt/boot
mount /dev/disk/by-label/nixos /mnt/boot/
nixos-generate-config --root /mnt/
# edit the config; see
# https://nixos.org/nixos/manual/index.html#sec-installation
vim /mnt/etc/nixos/configuration.nix
nixos-install
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment