Add nexus.provisioning host option for provisioning env pointers #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/provisioning-env-option"
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?
Closes allod/nexus#10.
Adds
nexus.provisioning.deployFlakeandnexus.provisioning.inventoryCheckoutto the host framework module (nixosModules.host,nix/configuration.nix). When set, each renders intoenvironment.sessionVariablesalongside the existingLIBVIRT_DEFAULT_URI, so the unwrappedrebuild-vm-from-host/provision-vm-from-hostscripts readDEPLOY_FLAKE/INVENTORY_CHECKOUTfrom the operator session without per-shell exports. This matches the current script contract after issue #5/#6:rebuild-vm-from-hostreads onlyDEPLOY_FLAKE;provision-vm-from-hostreads both (and re-exportsINVENTORY_CHECKOUTasINVENTORYtonew-vm).SECRETS_CHECKOUTis intentionally not added (removed by #6).inventoryCheckoutis documented as present only whileprovision-vm-from-hoststill readsINVENTORY_CHECKOUT, to be dropped in the same change that removes that read.The module was a config-only function; it now carries an
optionsblock with all prior settings moved underconfig, preserving thenixosModules.hostimport interface (only the standardconfig/libmodule args are added). Both options default tonulland render nothing when unset, so the public template host and the scripts' own$HOME/work/allod/{profiles,inventory}fallbacks are unchanged. The option type isnullOr (strMatching "^/.+"), so a malformed (empty or non-absolute) value fails evaluation loudly rather than rendering an empty variable that the scripts'${VAR:-default}fallback would silently replace with the baked default. This is the public option only; wiring a real deploy-flake/inventory location is a separate, private concern that composesnixosModules.hostand sets these.Risk
R1-R2. Single-repo, single-option change on the operator-convenience seam, no cross-repo interface change. The worst credible failure is a wrong rendered pointer aiming host-side rebuild/provision at the wrong deploy data, recoverable by reverting the host config or unsetting the variable for a manual run. No private host data is wired here, and host-side live rebuild/provision remains a human gate. Most useful human scrutiny: the option namespace/naming (
nexus.provisioning.*) and the absolute-path constraint. This PR also carries a test-only fix totests/registry-resolver.sh(see below), which adds no runtime or generated behavior.Validation
nix flake checkis green. A newhost-provisioning-envcheck composesnixosModules.hoston a minimal template host and asserts: (a) with the options set,environment.sessionVariablescarries the configuredDEPLOY_FLAKEandINVENTORY_CHECKOUT; (b) with them unset, neither variable is forced andLIBVIRT_DEFAULT_URIis unchanged; (c) an emptydeployFlakeand a relativeinventoryCheckouteach fail evaluation. Each assertion was confirmed to go red on sabotaged input (dropped renderer, weakened type) before reverting, so the check can actually catch a regression. The existingprovisioning-contractandno-hardcoded-archchecks stay green, and the aarch64 check variant evaluates (build omitted on the x86_64 host).An independent read-only review pass (subagent) found no correctness defects; its one substantive finding was that the malformed-pointer coverage exercised only
deployFlake. That is addressed by commit1f224ff, which adds the relative-inventoryCheckoutrejection case above.Also in this PR: fix for a master regression (
tests/registry-resolver.sh)This branch was rebased onto master
9168091("retire the on-VM self-rebuild; bootstrap is clone-only"), which dropped theprofiles_checkoutpositional frombootstrap-vm.sh(soSELF_REBUILDis$6withshift 6) and now refusesself_rebuild=truebefore any side effect.9168091re-pinnedtests/bootstrap-orchestration.shto the new vector but missedtests/registry-resolver.sh, leaving it red:bootstrap accepts valid triple argsstill passed the old seven-positional vector, so aftershift 6eleven trailing args (not a triple multiple) made the script exit on the triple-count check beforemkdir ~/work, failing the assertion;bootstrap rejects non-triple argspassed only by coincidence ("unknown source type 'true'"). Commit96cc0fbmoves both cases to the six-positional vector withself_rebuild=false, so each exercises its named behavior andnix flake checkon this branch is green. It is a test-only change and is isolated in its own commit, so it can be cherry-picked to land independently on master if you'd rather not carry it here.Render DEPLOY_FLAKE and INVENTORY_CHECKOUT into the operator session environment from nexus.provisioning.{deployFlake,inventoryCheckout}, so a host whose provisioning pointers differ from the baked $HOME/work/allod defaults no longer needs per-shell exports before rebuild-vm-from-host / provision-vm-from-host. Both options are unset by default and render nothing when unset, leaving the public template host and the scripts' own fallbacks unchanged; a malformed (non-absolute) value fails evaluation loudly instead of silently substituting a default. Add a host-provisioning-env flake check that composes nixosModules.host on a template host and asserts the set, unset, and malformed-rejection cases; the existing provisioning-contract and no-hardcoded-arch checks stay green.ae3dbbd79etoc7bfb0b3a7Ran an independent read-only review pass (subagent) on this change — no correctness defects. Its one substantive finding, that the malformed-pointer coverage exercised only
deployFlake, is applied as1f224ff(adds a relative-inventoryCheckoutrejection case to thehost-provisioning-envcheck; verified to go red when the probe is a value the type accepts).Note on the base: this branch was rebased onto master
9168091, which lefttests/registry-resolver.shred — its bootstrap arg-vector cases weren't updated for the droppedprofiles_checkoutpositional and the newself_rebuild=truerefusal. Per owner decision that regression is fixed here in96cc0fb(test-only, isolated commit — cherry-pickable to master if you'd rather it land separately).nix flake checkon the branch is now green.