From 178b0f39314ceed263e8d02cba5b327bdcf364f4 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 May 2024 19:14:21 +0100 Subject: [PATCH] add devices var to disko and modified bootstrap.sh --- scripts/bootstrap.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index d62f254..efc6c3b 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -16,6 +16,7 @@ cd ~ read -p "Enter hostname: " hostname read -p "Enter username: " username read -p "Enter ip address: " ip +read -p "Enter nixosSystem to build, e.g. 'bootstrap'" config KEY_DIR="$HOME/keys/$hostname/" mkdir -p $KEY_DIR @@ -36,8 +37,6 @@ overwrite="" [ -z "$overwrite" ] || [ "$overwrite" == "yes" ] && ssh-keygen -t ed25519 -f "$KEY_DIR/$KEY_NAME" -C "$hostname@$ip" -N "" echo "Copying ssh key to target host:" -# Rsync currently not available in Nixos. Use scp instead. -#rsync -av "ssh_ed25519_key_$hostname"* "root@$ip:/etc/ssh/" scp -i "$KEY_DIR/ssh_ed25519_key_$hostname"* "root@$ip:/etc/ssh/" [ $? != 0 ] && echo "Error copying keys to target host" && exit 1 @@ -52,7 +51,7 @@ echo "This needs to be inserted into .sops.yaml file." # Install Nixos bootstrap cd "$HOME/nixos" -SHELL=/bin/sh nix run github:nix-community/nixos-anywhere -- --flake .#bootstrap root@"$ip" -i "$KEY_DIR/ssh_ed25519_key_$hostname" +SHELL=/bin/sh nix run github:nix-community/nixos-anywhere -- --flake .#"$config" root@"$ip" -i "$KEY_DIR/ssh_ed25519_key_$hostname" [ $? != 0 ] && echo "Error installing Nixos" && exit 1 echo "Deleting host from known_hosts"