Files
nixos/overlays/setup-ssh/setup-ssh.sh
T

13 lines
428 B
Bash
Raw Normal View History

# vim: set ft=bash:
2023-08-19 01:08:26 +00:00
file="${HOME}/.ssh/id_ed25519"
if [ ! -f "${file}" ]; then
echo "Generating a new key"
2023-08-19 01:08:26 +00:00
ssh-keygen -t ed25519 -f "${file}" -N ''
cat "${file}.pub" >> /etc/nixos/home/ssh/authorized_keys
echo "Authing key to GitHub - may fail"
gh auth refresh -h github.com -s admin:public_key
2023-08-19 01:08:26 +00:00
gh ssh-key add -t ${HOSTNAME}-auto "${file}" || true
fi
cp /etc/nixos/home/ssh/authorized_keys "${HOME}/.ssh/authorized_keys"