Removed ambiguous unicode characters. Updated naming scheme. Added services selection.

This commit is contained in:
Raphaël Billet
2025-11-26 21:19:49 +01:00
parent c515903610
commit 49bf2043b0
7 changed files with 36 additions and 5 deletions
+36 -5
View File
@@ -105,7 +105,7 @@ hardware_detection() {
echo -e " ✅ NVIDIA graphics card detected."
TARGET_GRAPHICS="true"
else
echo -e " No dedicated graphics card detected."
echo -e " No dedicated graphics card detected."
TARGET_GRAPHICS="false"
fi
echo -e "\n\n 🔎 Detecting transconding acceleration on target host..."
@@ -113,7 +113,7 @@ hardware_detection() {
echo -e " ✅ Transcoding capable card detected."
TARGET_GRAPHICS_RENDERER="true"
else
echo -e " No transcoding capable card detected."
echo -e " No transcoding capable card detected."
TARGET_GRAPHICS_RENDERER="false"
fi
echo -e "\n\n 🔎 Detecting USB Google Coral TPU on target host..."
@@ -121,7 +121,7 @@ hardware_detection() {
echo -e " ✅ USB Google Coral TPU detected."
TARGET_USB_CORAL="true"
else
echo -e " No USB Google Coral TPU detected."
echo -e " No USB Google Coral TPU detected."
TARGET_USB_CORAL="false"
fi
echo -e "\n\n 🔎 Detecting Zigbee coordinator on target host..."
@@ -129,7 +129,30 @@ hardware_detection() {
echo -e " ✅ Zigbee device found in /dev/serial/by-id/."
TARGET_ZIGBEE_DEVICE=$(ssh_to_host "ls /dev/serial/by-id/ | grep -i 'zigbee'")
else
echo -e " No Zigbee device found."
echo -e " No Zigbee device found."
fi
}
services_selection() {
echo -e "\n\n ➡️ You will now select the services you want installed on your server:"
declare -A SERVICE_MAP
SERVICE_MAP["Pi-Hole: Block ads on all your devices"]="pihole"
SERVICE_MAP["Home Assistant: Manage your smart home or security cameras"]="hass"
SERVICE_MAP["Passbolt: Secure password manager with collaboration features"]="passbolt"
SERVICE_MAP["Frigate [Home Assistant required]: Secure your house with security cameras"]="frigate"
SERVICE_MAP["Nextcloud: No fuss Office 365 replacement"]="nextcloud"
SERVICE_MAP["Immich: Pictures and videos backup with local machine-learning"]="immich"
mapfile -t SERVICE_DESCRIPTIONS < <(for key in "${!SERVICE_MAP[@]}"; do echo "$key"; done | sort)
SELECTED_DESCRIPTIONS_STRING=$(gum choose --no-limit --header "Homelab services:" "${SERVICE_DESCRIPTIONS[@]}")
SERVICES=()
if [[ -n "$SELECTED_DESCRIPTIONS_STRING" ]]; then
while IFS= read -r line; do
SERVICES+=("${SERVICE_MAP[$line]}")
done <<< "$SELECTED_DESCRIPTIONS_STRING"
fi
}
@@ -191,6 +214,12 @@ files_generation() {
sed -i.bak "/# --- hass devices --- #/d" docker/hass.nix
fi
echo -e "\n\n ✅ Copying configuration files for the selected homelab services..."
cp docker/traefik.original docker/traefik.nix
for service in "${SERVICES[@]}"; do
cp docker/${service}.original docker/${service}.nix
done
echo -e "\n\n ✅ Copying files to the new installation..."
cp -ravu secrets/ .sops.yaml hardware-configuration.nix extra-files/etc/nixos/
@@ -335,7 +364,7 @@ disk_config_generation() {
for i in {0..2}; do export "PARITY_DISK_$((i+1))"="${parity_disks_final[$i]:-}"; done
fi
else
echo -e "\n No remaining disks to select for data."
echo -e "\n\n ⚠ No remaining disks to select for data."
fi
# --- Final Recap ---
@@ -464,6 +493,7 @@ if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then
necessary_credentials
setup_ssh
hardware_detection
services_selection
files_generation
disk_config_generation
generate_disko_config
@@ -473,6 +503,7 @@ elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a fi
necessary_credentials_with_config
setup_ssh
hardware_detection
services_selection
files_generation
disk_config_generation
generate_disko_config