aboutsummaryrefslogtreecommitdiff
path: root/nixos/os-installation.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/os-installation.sh')
-rw-r--r--nixos/os-installation.sh65
1 files changed, 45 insertions, 20 deletions
diff --git a/nixos/os-installation.sh b/nixos/os-installation.sh
index 9a78372..36342cb 100644
--- a/nixos/os-installation.sh
+++ b/nixos/os-installation.sh
@@ -1,5 +1,7 @@
+# Use GUI: it handles Wifi better!
+
# Check the devices and it's partitions:
-lsblk to check
+lsblk # to check the device names and sizes
# If under /dev/sdc and mounted:
sudo umount /dev/sdc1
@@ -18,31 +20,54 @@ wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase SSID PASSPHRASE)
loadkeys br-abnt2
# Format disk:
-fdisk /dev/sda
+gdisk /dev/nvme0n1 # disk found using lsblk
+
+# START Steps within gdisk
-# START Steps within fdisk
d # first, delete all partitions with `d`
-o
+o # create a new GUID partition table (GPT)
+
+## Create the BIOS boot partition
+n # create new partition
+1 # partition number
+ENTER # use default first sector
++1M # partition size of 1MB
+EF02 # set partition type to "BIOS boot partition"
+
+## Create the EFI System Partition
+n # create new partition
+2 # partition number
+ENTER # use default first sector
++500M # partition size of 500MB
+EF00 # set partition type to "EFI System"
+
+## Create the Linux LVM (where LUKS goes)
+n # create new partition
+3 # partition number
+ENTER # use default first sector
+ENTER # partition size is the remaining of the disk
+EF00 # set partition type to "EFI System"
+8E00 # set partition type to "Linux LVM"
+
+w
+# END Steps within gdisk
-n
-p
-1
-ENTER
-+4G
-t
-82
+cryptsetup luksFormat /dev/nvme0n1p3 # Initialize the encrypted partition
+cryptsetup luksOpen /dev/nvme0n1p3 enc-pv # Open encrypted partition volume
-n
-p
-2
-ENTER
-ENTER
+pvcreate /dev/mapper/enc-pv
+vgcreate vg /dev/mapper/enc-pv
+lvcreate -n swap vg -L 10G
+lvcreate -n root vg -l 100%FREE
-a
-2
+mkfs.vfat -n BOOT /dev/nvme0n1p2
+mkfs.ext4 -L root /dev/vg/root
+mkswap -L swap /dev/vg/swap
+
+mount /dev/vg/root /mnt
+mkdir /mnt/boot
+mount /dev/nvme0n1p2 /mnt/boot
-w
-# END Steps within fdisk
mkswap -L swap /dev/sda1
swapon /dev/sda1