add nixos-anywhere support

This commit is contained in:
Don Harper 2024-09-17 16:36:39 -05:00
parent 4c9df41806
commit 776abac029

View file

@ -2,7 +2,7 @@
set -o errexit
set -o errtrace
set -o nounset
# set -o nounset
debug=echo
@ -12,7 +12,7 @@ then
exit 1
fi
nixanywhere=~/src/nixos/nixos-anywhere-examples
nixanywhere=~/src/nixos/duckland/nixos-anywhere
nixsrc=~/src/nixos/duckland
ip="${1}"
host="${2}"
@ -23,12 +23,13 @@ then
exit 1
fi
cd "${nixanywhere}"
${debug} cd "${nixanywhere}"
${debug} ssh-keygen -R "${ip}"
${debug} nix run github:nix-community/nixos-anywhere -- --flake .#${host} root@"${ip}"
cd "${nixsrc}"
${debug} cd "${nixsrc}"
${debug} ssh-keygen -R "${ip}"
${debug} ssh root@"${ip}" nixos-generate-config
${debug} scp root@"${ip}":/etc/nixos/hardware-configuration.nix hosts/${host}/hardware-configuration.nix
${debug} git add hosts/${host}/hardware-configuration.nix
${debug} nixos-rebuild switch --flake .#${host} --target-host "root@"${ip}""
${debug} rsync -av ~/.ssh ~/bin don@"${ip}":