Skip to content

Commit

Permalink
Make disk encryption optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Sep 22, 2023
1 parent 9d31086 commit 5bc0652
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/apps/nixos-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ partition() {
}

echo '12'
create_volumes() {
_log "[create_volumes] Encrypting LVM partition..."
encrypt_partition() {
_log "[encrypt_partition] Encrypting LVM partition..."
cryptsetup luksFormat "${LVM_PARTITION}"
cryptsetup luksOpen "${LVM_PARTITION}" "${LVM_PV}"
}

create_volumes() {
_log "[create_volumes] Creating LVM volumes..."
pvcreate "/dev/mapper/${LVM_PV}"
vgcreate "${LVM_VG}" "/dev/mapper/${LVM_PV}"
Expand Down Expand Up @@ -161,8 +163,21 @@ install() {

echo '16'
# shellcheck disable=SC2310
if _read_boolean "Do you want to DELETE ALL PARTITIONS?" N; then
DO_PARTITION="$(_read_boolean "Do you want to DELETE ALL PARTITIONS?" N)" || true
readonly DO_PARTITION
if "${DO_PARTITION}"; then
partition
fi

echo '16-1'
# shellcheck disable=SC2310
DO_ENCRYPT="$(_read_boolean "Do you want to ENCRYPT THE DISK?" N)" || true
readonly DO_ENCRYPT
if "${DO_ENCRYPT}"; then
encrypt_partition
fi

if "${DO_PARTITION}"; then
create_volumes
create_filesystems
fi
Expand All @@ -178,7 +193,9 @@ fi

echo '18'
# shellcheck disable=SC2310
if _read_boolean "Do you want to INSTALL NixOS now?" N; then
DO_INSTALL="$(_read_boolean "Do you want to INSTALL NixOS now?" N)" || true
readonly DO_INSTALL
if "${DO_INSTALL}"; then
install
fi

0 comments on commit 5bc0652

Please sign in to comment.