feat: allow host to specified in installer
This commit is contained in:
parent
e9bfb11137
commit
2a6dae19d0
17
install.bash
17
install.bash
@ -4,6 +4,7 @@ install() {
|
||||
set -euo pipefail
|
||||
local disk="${1}"
|
||||
local encrypt_disk="${2}"
|
||||
local host="${3}"
|
||||
|
||||
local boot_partition="${disk}1"
|
||||
local primary_partition="${disk}2"
|
||||
@ -69,7 +70,7 @@ install() {
|
||||
# Persistence dir, dirs not to be wiped on reboot stored here
|
||||
mkdir -p /mnt/nix/persist
|
||||
# Actually install NixOS
|
||||
nixos-install --flake "git+file:.#orion"
|
||||
nixos-install --flake "git+file:.#${host}"
|
||||
# Finally, clone the flake into the persistent nixos config
|
||||
git clone . /mnt/nix/persist/etc/nixos/
|
||||
}
|
||||
@ -107,6 +108,7 @@ main() {
|
||||
fi
|
||||
|
||||
local disk=""
|
||||
local host=""
|
||||
local encrypt_disk="no"
|
||||
|
||||
while :; do
|
||||
@ -131,6 +133,11 @@ main() {
|
||||
encrypt_disk="yes"
|
||||
printf "Enabled disk encryption\n"
|
||||
;;
|
||||
-H | --host)
|
||||
shift
|
||||
host="${1}"
|
||||
printf "Set host to '%s'\n" "${host}"
|
||||
;;
|
||||
-?*)
|
||||
printf 'Unknown option: %s\n' "$1" >&2
|
||||
usage
|
||||
@ -147,14 +154,18 @@ main() {
|
||||
printf "Value for 'disk' (-d) was not provided! See '--help' for usage!\n"
|
||||
exit 1
|
||||
fi
|
||||
read -r -s -n 1 -p "Press any key to begin NixOS installation to '${disk}'!"
|
||||
if [[ -z "${host}" ]]; then
|
||||
printf "Value to 'host' (-H) was not provided! See '--help' for usage!\n"
|
||||
exit 1
|
||||
fi
|
||||
read -r -s -n 1 -p "Press any key to begin NixOS installation to '${disk}' for host '${host}'!"
|
||||
# printf "\nInstalling in "
|
||||
# for i in {3..1}; do
|
||||
# printf "%s.." "${i}"
|
||||
# sleep 1
|
||||
# done
|
||||
# printf "\n"
|
||||
install "${disk}" "${encrypt_disk}"
|
||||
install "${disk}" "${encrypt_disk}" "${host}"
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
|
Loading…
Reference in New Issue
Block a user