Created
November 9, 2017 01:29
-
-
Save anonymous/2a1a23340a8b7ebb577669547ade5e53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Prepare partitions | |
fdisk -l | |
$ gdisk /dev/sda | |
n # new partition | |
<enter> # default partition # | |
<enter> # default start location | |
+512M # size 512MB | |
ef00 # type boot | |
n # new partition | |
<enter> # default partition # | |
<enter> # default start location | |
<enter> # size remaining space | |
<enter> # type default | |
w # write partitions | |
y # confirm | |
## Configure Encryption | |
root_partition=/dev/sda$PARTITION_NUMBER # e.g., /dev/sda5 | |
cryptsetup luksFormat $root_partition | |
cryptsetup open --type luks $root_partition enc-pv | |
pvcreate /dev/mapper/enc-pv | |
vgcreate vg /dev/mapper/enc-pv | |
lvcreate -L 10G -n swap vg | |
lvcreate -l 100%VG -n root vg | |
## Format partitions | |
boot_partition=/dev/sda$PARTITION_NUMBER # e.g., /dev/sda4 | |
mkfs.vfat $boot_partition | |
mkfs.ext4 -j -L root /dev/vg/root | |
mkswap -L swap /dev/vg/swap | |
## Mount partitions | |
mount /dev/vg/root /mnt | |
mkdir /mnt/boot | |
mount $boot_partition /mnt/boot | |
swapon /dev/vg/swap | |
# Revert (this not necceseary just in case you wan't revert back here) | |
cryptsetup open --type luks $root_partition | |
lvchange -ay vg | |
## Configure | |
nixos-generate-config --root /mnt | |
## Install | |
nixos-install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment