Files
vps-nixos/scripts/install.sh
T
aloslider 67b1571e28 Init
Initial commit, nodes are mostly done, panel is WIP
2026-11-17 10:47:39 +03:00

28 lines
592 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
cd "$root"
source "$root/scripts/select-node.sh"
if [[ $# -ge 1 ]]; then
host=$1
else
host=$(select_node)
fi
age_key="${VPS_AGE_KEY:-$HOME/.config/sops/age/$host-key.txt}"
extra_dir=$(mktemp -d)
trap 'rm -rf "$extra_dir"' EXIT
read -rp "Remote user: " user
install -d -m 0700 "$extra_dir/etc/age"
install -m 0600 "$age_key" "$extra_dir/etc/age/key.txt"
nix run github:nix-community/nixos-anywhere -- \
--no-disko-deps \
--flake ".#$host" \
--target-host "$user@$host" \
--extra-files "$extra_dir"