aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2026-09-15 20:29:29 +0000
committerKumar Damani <me@kumardamani.net>2026-09-15 21:09:51 +0000
commit276c9bd2a751f90911689a37e3a86f4a26056e23 (patch)
tree626dd69d29a2a4f57a5dcdbc6738c8c12a98b606 /nix
parent0b47dfe796edd63cf121c64e53de95dfc17c580d (diff)
automate adding new host flow
Diffstat (limited to 'nix')
-rw-r--r--nix/README.md17
-rwxr-xr-xnix/generate-keys.sh3
2 files changed, 3 insertions, 17 deletions
diff --git a/nix/README.md b/nix/README.md
index 95cd4ac..920e9d3 100644
--- a/nix/README.md
+++ b/nix/README.md
@@ -28,25 +28,8 @@ Convert to Proxmox Template:
ssh lan.hesh 'qm template 104'
```
-Run TF as usual using clone against the Template.
-```sh
-cd ../terraform
-source con.env
-tofu plan -out=tfplan
-tofu apply tfplan
-```
-
## Add Host
-Scaffold a new host (host keys, `.sops.yaml`, `flake.nix`, `per-host/`, secrets, TF VM if absent, `~/.ssh/config`, Hosts section) and print the exact cmds to create the VM and deploy:
-```sh
-./add.sh <HOST_NAME> # interactive for cpu/mem/disk/vlan
-./add.sh <HOST_NAME> --cpu 1 --mem 1024 --disk 10G --vlan 30
-```
-
-Defaults for cpu/mem/disk/vlan are taken from `monitoring-2`. If the VM already exists in TF it is left alone.
-
-The manual equivalent, if needed:
```sh
./generate-keys.sh <HOST_NAME>
diff --git a/nix/generate-keys.sh b/nix/generate-keys.sh
index 611d931..89484e7 100755
--- a/nix/generate-keys.sh
+++ b/nix/generate-keys.sh
@@ -2,6 +2,9 @@
# Generate a host key for a specific host
set -euo pipefail
+# Resolve paths relative to this script, not the caller's CWD
+cd -- "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")"
+
HOST="$1"
mkdir -p "./host-keys/${HOST}"
ssh-keygen -t ed25519 -f "./host-keys/${HOST}/ssh_host_ed25519_key" -N ""