nix-dotfiles/utils/hetzner-install.sh

28 lines
967 B
Bash
Raw Normal View History

#!/usr/bin/env nix
#! nix shell nixpkgs#bash nixpkgs#git --command bash
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
MACHINENAME="hetzner-bridge"
sudo mkdir /root/.ssh
sudo chmod 700 /root/.ssh
sudo ssh-keygen -t ed25519 -o -a 100 -f "/root/.ssh/id_ed25519_giteadeploy" -q -N "" -C "$MACHINENAME" || echo "key already exists"
sudo cat /root/.ssh/id_ed25519_giteadeploy.pub
sudo ssh-keygen -A
nix --extra-experimental-features 'flakes nix-command' shell nixpkgs#git
nix --extra-experimental-features 'flakes nix-command' store gc
FLAKE="git+ssh://gitea@nayeonie.com:2222/ahuston-0/nix-dotfiles?ref=feature/hetzner-bridge#hetzner-bridge"
DISK_DEVICE=/dev/sda
sudo nix \
--extra-experimental-features 'flakes nix-command' \
run github:nix-community/disko#disko-install -- \
--flake "$FLAKE" \
--write-efi-boot-entries \
--disk main "$DISK_DEVICE"