add devices var to disko and modified bootstrap.sh
This commit is contained in:
parent
f6b48d0b25
commit
178b0f3931
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue