machines-config/scripts/bootstrap.sh

23 lines
404 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Parameters
ip=$1
if [ -z "$ip" ]; then
echo "Usage: $0 <ip>"
exit 1
fi
# This script is used to bootstrap nixos machine so I can get their ssh keys
nix run \
github:nix-community/nixos-anywhere \
-- \
--flake '.#bootstrap' \
--target-host root@$ip \
--build-on-remote
ret=$?
if [ $ret -ne 0 ]; then
echo "Failed to bootstrap $ip"
exit $ret
fi