diff --git a/scripts/prepare-host-key.sh b/scripts/prepare-host-key.sh index 1277f55..51bd6e9 100755 --- a/scripts/prepare-host-key.sh +++ b/scripts/prepare-host-key.sh @@ -26,7 +26,7 @@ if [[ ! -f "$sops_yaml" ]]; then exit 1 fi -keydir="$(dirname "$0")/../host-keys" +keydir="$(cd "$(dirname "$0")/.." && pwd)/host-keys" mkdir -p "$keydir" keyfile="${keydir}/${hostname}_ssh_host_ed25519_key" @@ -35,16 +35,16 @@ if [[ -f "$keyfile" ]]; then exit 1 fi -nix-shell -p openssh ssh-to-age --run " - set -euo pipefail - ssh-keygen -t ed25519 -N '' -C '${hostname}' -f '${keyfile}' >/dev/null - age_pub=\$(ssh-to-age -i '${keyfile}.pub') - cat </dev/null + +age_pub="$(nix-shell -p ssh-to-age --run "ssh-to-age -i '${keyfile}.pub'")" + +cat <