feat(nix): add controller-to-target test workflow #246
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:electra
host:fleet
host:lyra
host:nova
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!246
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-236-electra-nova-vega"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #236
Adds a test-only Electra controller -> Nova builder -> Vega target workflow, including a controller-only signing key for verified closure transfer.
Local validation:
nix flake check, shell syntax, and existing deploy regression suites. Live canary evidence remains required before merge.Automated code review
Reviewed commit:
30c8e27a55849b4b366e12aab4ad474a670e2ce7Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The PR introduces a controller-to-target test workflow allowing Electra to build a NixOS configuration for Vega on the Nova remote builder, sign the resulting closure with a dedicated Electra key, and activate it on Vega using
switch-to-configuration test. It introduces a new SOPS-managed signing key, updates common Nix settings to trust this key, and adds documentation and Justfile recipes.Blocking findings
The script uses
set -euo pipefailand chains commands likenix copyandssh ... switch-to-configuration test. If the SSH connection to the target drops during the large closure copy or activation, the script exits with an error, leaving the target in a potentially inconsistent state (e.g., partially copied files) or simply failing without cleanup of the temporary snapshot.Impact: The test workflow is fragile and may leave temporary artifacts or fail silently on network issues, making debugging difficult.
Suggested fix: Add explicit error handling for
nix copyandsshcommands. Consider adding a timeout to the SSH command and ensuring the temporary snapshot directory is cleaned up even if intermediate steps fail (the trap handles this, but the user experience is poor).Important findings
The script hardcodes
novain the builder string:--option builders "ssh://nix-remote-builder@nova ...". The documentation also refers to Nova as the remote builder.Impact: This couples the controller test workflow to a specific host named 'nova'. If the remote builder hostname changes or if this workflow is adapted for other hosts, the script must be modified. It reduces flexibility.
Suggested fix: Make the remote builder hostname configurable via an environment variable (e.g.,
NIXOS_CONTROLLER_REMOTE_BUILDER_HOST) with a default of 'nova'.Suggestions
Missing validation of target host's NixOS version compatibility (scripts/nixos-controller-test.sh:1; medium confidence)
The script builds a configuration for
$targetand copies it. It does not check if the target host is running a compatible NixOS version or if theswitch-to-configurationbinary is present.Impact: If the target host is not running NixOS or is running a significantly different version, the activation step may fail in unexpected ways.
Suggested fix: Add a preliminary check to verify that the target host is reachable and has a compatible NixOS installation before attempting the build and copy.
Secret key paths rely on environment variables with defaults (scripts/nixos-controller-test.sh:75; medium confidence)
The script uses
NIXOS_CONTROLLER_REMOTE_BUILDER_KEYandNIXOS_CONTROLLER_SIGNING_KEYwith defaults pointing to/run/secrets/.... These paths assume SOPS has decrypted the secrets into these specific locations.Impact: If the secrets are not deployed to these exact paths, the script will fail. This is a valid assumption given the host configuration, but it's worth noting that the script is tightly coupled to the SOPS deployment structure.
Suggested fix: Ensure the documentation clearly states that these secrets must be present at the default locations or that the environment variables must be set accordingly.
Tests and validation
Questions
nomused instead ofnixfor the build command in the script?Review limitations
nix flake checkor test the script locally.Diff coverage
.sops.yaml: reviewed — included in a context-limited batchREADME.md: reviewed — included in a context-limited batchdocs/nova-remote-builder.md: reviewed — included in a context-limited batchhosts/electra/default.nix: reviewed — included in a context-limited batchjustfiles/deploy.just: reviewed — included in a context-limited batchmodules/common/nix-settings.nix: reviewed — included in a context-limited batchscripts/nixos-controller-test.sh: reviewed — included in a context-limited batchsecrets/nix-controller/electra-signing-key.json: reviewed — included in a context-limited batchReview metadata
912ac4aff430c8e27a55