diff --git a/deploy.sh b/deploy.sh index d0968c7..4663328 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 diff --git a/docker/frigate.nix b/docker/frigate.original similarity index 100% rename from docker/frigate.nix rename to docker/frigate.original diff --git a/docker/hass.nix b/docker/hass.original similarity index 100% rename from docker/hass.nix rename to docker/hass.original diff --git a/docker/nextcloud.nix b/docker/nextcloud.original similarity index 100% rename from docker/nextcloud.nix rename to docker/nextcloud.original diff --git a/docker/passbolt.nix b/docker/passbolt.original similarity index 100% rename from docker/passbolt.nix rename to docker/passbolt.original diff --git a/docker/pihole.nix b/docker/pihole.original similarity index 100% rename from docker/pihole.nix rename to docker/pihole.original diff --git a/docker/traefik.nix b/docker/traefik.original similarity index 100% rename from docker/traefik.nix rename to docker/traefik.original