Kyushu Nagoya ARM Builder Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Configure Kyushu to submit native aarch64-linux builds to Nagoya using a separate restricted SSH builder key.
Architecture: The common Fedora host-artifact generator will identify both Aomi and Kyushu as Nagoya builder clients and generate the same local Nix builder wiring. A generic Nagoya authorization helper will add a supplied public key as a forced-command SSH identity. Kyushu receives its own private key outside Git.
Tech Stack: Nix flakes, Nix-generated Fedora system artifacts, Bash, OpenSSH, Nix remote builders.
Global Constraints
- Do not commit private key material, log it, or document it.
- Kyushu and Aomi use distinct builder keypairs, although each local private key path is
/etc/nix/keys/nagoya-builder. - Nagoya builder keys must be limited to
restrict,command="/nix/var/nix/profiles/default/bin/nix-daemon --stdio". - Do not add ARM emulation/binfmt or a general builder-inventory abstraction.
- Do not deploy to Kyushu or Nagoya without a fresh explicit confirmation after showing the diff and successful build results.
- Do not commit unless the user explicitly requests it.
Task 1: Generalize generated Fedora Nagoya-builder configuration
Files:
- Modify:
systems/common/fedora-work/gen-configs.nix:7-107 - Modify:
systems/common/fedora-work/test-gen-configs.sh:8-15
Interfaces:
-
Consumes:
hostname,globals.machines.nagoya.ssh.hostKey, andlib.elem. -
Produces:
fedoraConfigs.aomiandfedoraConfigs.kyushuartifacts containing/etc/nix/machinesand/etc/ssh/ssh_known_hosts. -
Step 1: Extend the static generator test to require Kyushu support
Replace the Aomi-only build check in systems/common/fedora-work/test-gen-configs.sh with artifact-content checks for both clients:
for host in aomi kyushu; do
out=$(nix build --no-link --print-out-paths ".#fedoraConfigs.$host")
test -f "$out/etc/nix/machines"
test -f "$out/etc/ssh/ssh_known_hosts"
done
Keep the existing static checks and change the comment to say that Aomi and Kyushu delegate native ARM builds to Nagoya.
- Step 2: Run the test and verify it fails for Kyushu before implementation
Run:
bash systems/common/fedora-work/test-gen-configs.sh
Expected: failure at test -f "$out/etc/nix/machines" for Kyushu, because its generated artifact does not yet include builder files.
- Step 3: Replace the Aomi-only condition with the two-host builder-client condition
In gen-configs.nix, define:
isNagoyaBuilderClient = builtins.elem hostname [ "aomi" "kyushu" ];
Use it for all conditional builder behavior: adding builders-use-substitutes, installing /etc/nix/machines, installing /etc/ssh/ssh_known_hosts, and copying those files into the generated output. Do not change the Nix machine endpoint, architecture, key path, speed factor, or parallelism:
ssh-ng://vincent@nagoya.vpn aarch64-linux /etc/nix/keys/nagoya-builder 4 1
- Step 4: Run generator verification
Run:
bash systems/common/fedora-work/test-gen-configs.sh
nix build .#fedoraConfigs.kyushu --dry-run
Expected: both Fedora config artifacts evaluate/build dry-run successfully, and the static test passes.
Task 2: Generalize Nagoya builder-key authorization and register Kyushu’s public identity
Files:
- Move:
imperative/nagoya/authorize-aomi-builder.shtoimperative/nagoya/authorize-builder.sh - Modify:
imperative/nagoya/test-builder-key.sh:5-11 - Modify:
globals.nixSSH keys set adjacent toaomi-nagoya-builder - Modify:
imperative/nagoya/README.mdauthorization documentation, if it names Aomi as the only client
Interfaces:
-
Consumes:
KEY_FILE(default/etc/nix/keys/nagoya-builder.pub),NAGOYA_HOST(defaultnagoya.vpn), andSSH_KEY(default$HOME/.ssh/id_homelab_sk). -
Produces: an idempotent constrained
authorized_keysentry onvincent@nagoya. -
Step 1: Change the authorization test to require a generic helper
In test-builder-key.sh, set:
helper="$repo_root/imperative/nagoya/authorize-builder.sh"
Require the forced command and require both registered key identifiers:
grep -q 'aomi-nagoya-builder' "$repo_root/globals.nix"
grep -q 'kyushu-nagoya-builder' "$repo_root/globals.nix"
- Step 2: Run the test and verify it fails before implementation
Run:
bash imperative/nagoya/test-builder-key.sh
Expected: failure because the generic helper and the Kyushu registry entry do not yet exist.
- Step 3: Rename and generalize the authorizer without changing its security behavior
Move the helper to authorize-builder.sh; change its comment to describe a supplied dedicated Nix builder public key rather than Aomi. Keep the existing defaults, validation, IdentitiesOnly=yes, and idempotent remote append. The exact restricted entry must stay:
authorized_key="restrict,command=\"/nix/var/nix/profiles/default/bin/nix-daemon --stdio\" $public_key"
- Step 4: Generate Kyushu’s dedicated keypair and register only its public half
Create the key outside the repository, with an identifying comment:
ssh-keygen -t ed25519 -f /tmp/kyushu-nagoya-builder -C kyushu-nagoya-builder
Add the resulting public-key text to globals.nix under:
kyushu-nagoya-builder = {
key = "ssh-ed25519 … kyushu-nagoya-builder";
access.vincent.nagoya = "trusted";
};
Do not add /tmp/kyushu-nagoya-builder or its private content anywhere in the repository.
- Step 5: Run local authorization and Nix evaluation checks
Run:
bash imperative/nagoya/test-builder-key.sh
nix eval --raw '.#fedoraConfigs.kyushu.drvPath' >/dev/null
Expected: the script passes and the Kyushu Fedora artifact evaluates.
Task 3: Review changes, remove the temporary design spec, and prepare deployment evidence
Files:
- Delete:
docs/superpowers/specs/2026-09-11-kyushu-nagoya-builder-design.md - Retain:
docs/superpowers/plans/2026-09-11-kyushu-nagoya-builder.md
Interfaces:
-
Consumes: completed Tasks 1 and 2.
-
Produces: a reviewed diff and local validation evidence for a user-approved live deployment.
-
Step 1: Remove the temporary approved design spec
Run:
rm docs/superpowers/specs/2026-09-11-kyushu-nagoya-builder-design.md
- Step 2: Run all repository-level checks
Run:
bash systems/common/fedora-work/test-gen-configs.sh
bash imperative/nagoya/test-builder-key.sh
nix build .#fedoraConfigs.kyushu --dry-run
Expected: all commands exit zero.
- Step 3: Inspect and present the exact change set
Run:
git diff --check
git diff -- systems/common/fedora-work/gen-configs.nix systems/common/fedora-work/test-gen-configs.sh imperative/nagoya/authorize-builder.sh imperative/nagoya/test-builder-key.sh imperative/nagoya/README.md globals.nix docs/superpowers/specs/2026-09-11-kyushu-nagoya-builder-design.md
git status --short
Expected: no whitespace errors; no private key files tracked or untracked in the repository.
- Step 4: Obtain explicit permission for live deployment
Show the user the diff and successful local check results. Ask permission to deploy the generated Kyushu artifact, install its root-only key, authorize the key on Nagoya, and run remote-build verification.
Task 4: Deploy and verify Kyushu’s remote builder
Files:
- No repository files changed.
- Create temporarily:
/tmp/kyushu-nagoya-builderand/tmp/kyushu-nagoya-builder.pub, then delete both. - Install on Kyushu:
/etc/nix/keys/nagoya-builderand/etc/nix/keys/nagoya-builder.pub.
Interfaces:
-
Consumes: the generated
fedoraConfigs.kyushuartifact and temporary keypair from Task 2. -
Produces: Kyushu’s root Nix daemon can connect to Nagoya and dispatch native ARM builds.
-
Step 1: Activate the generated Kyushu system artifact
On Kyushu, run the Fedora system configuration workflow:
nix build .#fedoraConfigs.kyushu && sudo ./result/deploy
Expected: /etc/nix/machines and /etc/ssh/ssh_known_hosts are present, and /etc/nix/nix.custom.conf enables builder substitutes.
- Step 2: Install the distinct Kyushu key with restrictive permissions
On Kyushu, run:
sudo install -d -o root -g root -m 0700 /etc/nix/keys
sudo install -o root -g root -m 0600 /tmp/kyushu-nagoya-builder /etc/nix/keys/nagoya-builder
sudo install -o root -g root -m 0644 /tmp/kyushu-nagoya-builder.pub /etc/nix/keys/nagoya-builder.pub
Expected: only root can read the private key.
- Step 3: Authorize Kyushu’s public key on Nagoya
On Kyushu, run:
bash imperative/nagoya/authorize-builder.sh
Expected: the restricted key is added once to vincent@nagoya’s authorized_keys; rerunning the command does not duplicate it.
- Step 4: Delete temporary secret files
Run:
rm -f /tmp/kyushu-nagoya-builder /tmp/kyushu-nagoya-builder.pub
Expected: the temporary keypair no longer exists.
- Step 5: Verify protocol access and reject interactive access
From Kyushu, test the restricted key without SSH connection sharing:
ssh -o ControlMaster=no -o ControlPath=none -i /etc/nix/keys/nagoya-builder -o IdentitiesOnly=yes vincent@nagoya.vpn true
Expected: the command is rejected because the key may only run the forced Nix-daemon command.
- Step 6: Force an uncached ARM remote build
From Kyushu, build a unique disposable ARM derivation with no local build slots:
nix build --option max-jobs 0 --expr 'with import <nixpkgs> { system = "aarch64-linux"; }; runCommand "kyushu-nagoya-builder-key-test" {} "echo aarch64 > $out"'
Expected: Nix reports building ... on 'ssh-ng://vincent@nagoya.vpn' and copies the result back; the output contains aarch64.