Skip to content

Instantly share code, notes, and snippets.

@nasirhm
Forked from alcol80/btrfs-nixos-install.sh
Last active August 24, 2023 08:55
Show Gist options
  • Save nasirhm/7ecf9f0ce241f85001b262cdd60bcdfc to your computer and use it in GitHub Desktop.
Save nasirhm/7ecf9f0ce241f85001b262cdd60bcdfc 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