|
|
|
@ -81,6 +81,9 @@ chmod 644 "$temp/persist/etc/ssh/ssh_host_ed25519_key.pub"
|
|
|
|
|
|
|
|
|
|
# Install Nixos to target
|
|
|
|
|
cd "$HOME/nixos"
|
|
|
|
|
git add . && git commit -m "auto: bootstrapping $hostname" && git push
|
|
|
|
|
[ $? != 0 ] && echo "Error commiting current changes" && exit 1
|
|
|
|
|
|
|
|
|
|
SHELL=/bin/sh nix run github:nix-community/nixos-anywhere -- --extra-files "$temp" --flake .#"$config" root@"$ip" -i "$HOME/.ssh/id_ed25519"
|
|
|
|
|
[ $? != 0 ] && echo "Error installing Nixos" && exit 1
|
|
|
|
|
|
|
|
|
@ -166,8 +169,8 @@ do
|
|
|
|
|
[ "$confirm" = "yes" ] && break
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
ssh -i "$(readlink -f "$HOME/.ssh/id_ed25519")" "$username@$ip" "nix-shell -p git --run 'git clone git@git.bitlab21.com:sam/nixos.git ~/keep/'"
|
|
|
|
|
ssh -i "$(readlink -f "$HOME/.ssh/id_ed25519")" "$username@$ip" "nix-shell -p git --run 'git clone git@git.bitlab21.com:sam/nix-secrets.git ~/keep/'"
|
|
|
|
|
ssh -i "$(readlink -f "$HOME/.ssh/id_ed25519")" "$username@$ip" "nix-shell -p git --run 'git clone git@git.bitlab21.com:sam/nixos.git ~/keep/nixos/'"
|
|
|
|
|
#ssh -i "$(readlink -f "$HOME/.ssh/id_ed25519")" "$username@$ip" "nix-shell -p git --run 'git clone git@git.bitlab21.com:sam/nix-secrets.git ~/keep/'"
|
|
|
|
|
|
|
|
|
|
echo -e "###\nSuccessfully installed Nixos on the target host!\n###"
|
|
|
|
|
#echo "Please remote into the new host and run 'sudo nixos-generate-config && cp /etc/nixos/hardware-configuration.nix /home/$username/nixos/hosts/$hostname/'"
|
|
|
|
|