diff --git a/deploy.sh b/deploy.sh index 3d582fd..a8dc7ad 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,84 +1,78 @@ -#@GEMINI.md @agents Take the NixOS expert role. I would like to make this installer universal, this means that the disko config has to adapt -#to the available disks in the system. Since covering every possible disk configuration would be impossible, I would like to cover a few of them -#that are relevant in the context of a home server. First I want every disk to be encrypted. Second, there always has to be a boot drive on which -#nixos, docker and config data (small data) is installed. This drive can be standalone (even though that is kind of pointless in production but this -#is more for testing purposes). Third, if present, other disks (2 or 3 never more) than the boot drive must be used in a redundant way for the -#big data (nextcloud user data, immich photos, ...). Fourth, if the data disks are SSDs or NVMes, they must use ZFS (mirror or raid1). - #!/bin/bash -set -euo pipefail - -cat < /dev/null; then + echo " ❌ 'gum' is not installed. Please install it to use the interactive TUI." + echo " Add 'gum' to your configuration.nix in the system packages section." + exit 1 +fi +if ! command -v openssl &> /dev/null; then + echo " ❌ 'openssl' is not installed." + echo " Add 'openssl' to your configuration.nix in the system packages section." + exit 1 +fi + +# Choose the action +ACTION_ANSWER=$(gum choose "[1] 🌐 Deploy NixOS on a remote machine" "[2] 💽 Deploy NixOS on a remote machine with a file configuration" "[3] 🛠️ Update a NixOS remote machine") +echo $ACTION_ANSWER + +if [[ "$ACTION_ANSWER" == "[1] 🌐 Deploy NixOS on a remote machine" ]]; then echo -e "\n ➡️ Proceeding with deployment…" - nixos_deployment -elif [[ "$ACTION_ANSWER" == "2" ]]; then + install_prerun_action + necessary_credentials + files_generation +elif [[ "$ACTION_ANSWER" == "[2] 💽 Deploy NixOS on a remote machine with a file configuration" ]]; then echo -e "\n ➡️ Proceeding with deployment using a config file…" - nixos_deployment_with_config -elif [[ "$ACTION_ANSWER" == "3" ]]; then + install_prerun_action + necessary_credentials_with_config + files_generation +elif [[ "$ACTION_ANSWER" == "[3] 🛠️ Update a NixOS remote machine" ]]; then echo -e "\n ➡️ Proceeding with update…" + update_prerun_action nixos_update else echo "Aborting - you did not type '1, 2 or 3'." diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..2268f60 --- /dev/null +++ b/test.sh @@ -0,0 +1,5 @@ +ssh_to_host() { + ssh raphael@192.168.11.1 "$1" +} +VGA_INFO=$(ssh_to_host "lspci -nn | grep -i 'vga'") +echo $VGA_INFO \ No newline at end of file