mkHypervisor has no disko module — host disk layout cannot be declarative #12
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
allod/archetypes#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
The hypervisor builder cannot evaluate a declarative disk layout, so a host's disk topology has to stay a hand-maintained UUID module while every VM archetype already gets disko. Bring the hypervisor archetype up to the same standard as the VM archetypes.
Primary goals:
vm/diskopin rather than adding an independent one, so the framework keeps one source of truth for the disko revision.mkHypervisorgainsdisko.nixosModules.diskoso a consumer's hardware module can declaredisko.devices.disko.devicesin the evaluated configuration this must be a zero-diff change, provable by comparing built system closures.Current state
mkHypervisor(flake.nix:232) assembles the host module list, and atflake.nix:248it currently reads:There is no disko module in that list, and
flake.nixdeclares nodiskoinput. Disko is reachable in the wider stack only throughallod/vm, which pins it atvm/flake.nix:18-21.vm.nixosModules.qemuGuestis not reusable here. It welds three things into one bundle atvm/flake.nix:30-31—disko.nixosModules.disko,./disk.nix(the VM layout, hardcoded to/dev/vdawith no encryption), andmodules/qemu-guest.nix. Importing it on a hypervisor would drag in the VM disk layout and the QEMU guest configuration.The result is an asymmetry: VM archetypes get a declarative disk through
qemuGuest, and the hypervisor archetype gets nothing, so host disk topology stays imperative and machine-bound.Proposed change
Add the input, following the existing pin:
Add
diskoto theoutputsargument list, then add the module ahead of the rest inmkHypervisor:Validation
A disko module with no
disko.devicesdeclared should produce no configuration, so the evaluated system must be unchanged. Compare derivation paths rather than building — identical.drvproves identical output, and building a full host closure is expensive and unnecessary for this:Run it before and after the change, using the same
--override-inputon both sides so the only difference is the code. Identical drvPaths prove the change inert and it can land with no risk to a running host. If they differ, diff the two derivations and explain the difference before merging rather than accepting it.Pair this with a non-vacuity check, so an identical drvPath cannot be mistaken for "the module never loaded":
config.disko.devicesshould fail to evaluate before the change and resolve to the module's empty-device attrset after it.nix flake checkshould pass unchanged.Scope
In scope: the
diskoinput wiring and the module import in the hypervisor builder, plus the store-path equivalence check.Out of scope: any actual
disko.devicesdeclaration. Disk topology is machine data and belongs in a consumer's inventory hardware module, not in the framework. Also out of scope: converting an existing host from a UUID hardware module to a disko declaration, which is consumer-side migration work with its own rollback requirements.Landed on master as
1420e8f. Verified inert:config.system.build.toplevel.drvPathis identical before and after against a consumer configuration that declares no devices, with the same--override-inputon both sides. Non-vacuity confirmed —config.disko.devicesfails to evaluate before the change and resolves to the module's empty-device attrset after, so the unchanged derivation is not simply the module failing to load.nix flake check --no-buildpasses. The lock gained only afollowsentry, no second disko node.