Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Prompt for LUKS password
- read -s -p "Enter LUKS Password: " luks_password
- echo
- sudo gdisk /dev/sda
- sudo cryptsetup -v -y -c aes-xts-plain64 -s 512 -h sha512 -i 2000 --use-random --label=NIXOS_LUKS luksFormat --type luks2 /dev/sda2 <<< "$luks_password"
- sudo cryptsetup open --type luks /dev/sda2 cryptroot <<< "$luks_password"
- sudo pvcreate /dev/mapper/cryptroot
- sudo vgcreate lvmroot /dev/mapper/cryptroot
- sudo lvcreate -L8G lvmroot -n swap
- sudo lvcreate -L128G lvmroot -n root
- sudo lvcreate -l 100%FREE lvmroot -n home
- sudo mkfs.fat -n NIXOS_BOOT -F32 /dev/sda1
- sudo mkfs.ext4 -L NIXOS_ROOT /dev/mapper/lvmroot-root
- sudo mkfs.ext4 -L NIXOS_HOME /dev/mapper/lvmroot-home
- sudo mkswap -L NIXOS_SWAP /dev/mapper/lvmroot-swap
- sudo mount /dev/disk/by-label/NIXOS_ROOT /mnt
- sudo mkdir /mnt/boot
- sudo mkdir /mnt/home
- sudo mount -o umask=0077 /dev/disk/by-label/NIXOS_BOOT /mnt/boot
- sudo mount /dev/disk/by-label/NIXOS_HOME /mnt/home
- sudo swapon -L NIXOS_SWAP
- sudo nixos-generate-config --root /mnt
- sudoedit /mnt/etc/nixos/hardware-configuration.nix
- sudoedit /mnt/etc/nixos/configuration.nix
- sudo nixos-install
- echo "Install is finished! Please do the following to shutdown softly:"
- echo "sudo umount -R /mnt to unmount /mnt."
- echo "sudo swapoff -L NIXOS_SWAP"
- echo "sudo vgchange -a n lvmroot"
- echo "sudo cryptsetup close /dev/mapper/cryptroot"
- echo "ENJOY YOUR NIXOS SYSTEM!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement