diff --git a/SwarselSystems.org b/SwarselSystems.org index f4a1aa9..eb1b3d9 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -3040,11 +3040,21 @@ This program sets up a new NixOS host. git clone https://github.com/Swarsel/.dotfiles.git fi + local_keys=$(ssh-add -L) + pub_key=$(cat /home/"$target_user"/.dotfiles/secrets/keys/ssh/nbl-imba-2.pub) + read -ra pub_arr <<< "$pub_key" + cd .dotfiles + if [[ $local_keys == *"${pub_arr[1]}"* ]]; then + yellow "The ssh key for this configuration is not available." + green "Adjusting flake.nix so that the configuration is buildable" + sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix + fi sudo nixos-generate-config --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/ git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/hardware-configuration.nix green "Installing flake $target_flake" sudo nixos-rebuild --show-trace --flake .#"$target_flake" --keep-going switch + yellow "Please keep in mind that this is only a demo of the configuration. Things might break unexpectedly." #+end_src diff --git a/scripts/swarsel-install.sh b/scripts/swarsel-install.sh index 3baf58f..530cf64 100644 --- a/scripts/swarsel-install.sh +++ b/scripts/swarsel-install.sh @@ -57,8 +57,18 @@ if [ ! -d /home"$target_user"/.dotfiles ]; then git clone https://github.com/Swarsel/.dotfiles.git fi +local_keys=$(ssh-add -L) +pub_key=$(cat /home/"$target_user"/.dotfiles/secrets/keys/ssh/nbl-imba-2.pub) +read -ra pub_arr <<< "$pub_key" + cd .dotfiles +if [[ $local_keys == *"${pub_arr[1]}"* ]]; then + yellow "The ssh key for this configuration is not available." + green "Adjusting flake.nix so that the configuration is buildable" + sed -i '/nix-secrets = {/,/^[[:space:]]*};/d' flake.nix +fi sudo nixos-generate-config --dir /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/ git add /home/"$target_user"/.dotfiles/hosts/nixos/"$target_flake"/hardware-configuration.nix green "Installing flake $target_flake" sudo nixos-rebuild --show-trace --flake .#"$target_flake" --keep-going switch +yellow "Please keep in mind that this is only a demo of the configuration. Things might break unexpectedly."