Key the profile shape check off flakeExposed and validate at the consumed surface #3
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/profiles#3
Loading…
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?
Remove the hardcoded architecture list from the profile shape check and validate the contract on the surface the framework actually consumes, without adding an
inventoryinput. The list this check carries was never machine-platform policy, so it should not be derived from inventory; it should stop looking like policy and the validation it guards should fire where consumers read it.Primary goals:
checkSystems = [ "x86_64-linux" "aarch64-linux" ]withnixpkgs.lib.systems.flakeExposed, so no literal in this repo reads as a machine-platform-policy list.lib.profileDefinitionsso any consumer (the archetypes framework at composition time) trips them, not only a standalonenix flake checkin this repo.inventoryorsecretsinput; the check is platform-independent and needs onlynixpkgs.profile-contract-shapecheck, forcing the shared contract viabuiltins.seqsonix flake checkhere still exercises it.Current state
flake.nix:21hardcodescheckSystems = [ "x86_64-linux" "aarch64-linux" ], consumed only atflake.nix:88to key thechecksoutput. The check body (flake.nix:91-99) is a pair of eval-time asserts (profileDefinitionsis an attrset;shapeErrors == []) plus a no-oprunCommandthat onlytouches its output. It never reads the architecture, so the list is scaffolding to satisfy the system-keyedchecksschema, not machine policy — and it cannot drift from inventory because it encodes nothing about machines.Nothing downstream consumes
checks: the archetypes framework readsprofiles.lib.profileDefinitions(allod/archetypesflake.nix:121,124,343) andprofiles.homeModules.preferences(flake.nix:286), but notprofiles.checks. Since a downstreamnix flake checkdoes not run an input's checks, this shape check fires only when run standalone in this repo. The scenario the repo header exists to serve — an operator redirecting the framework'sprofilesinput at their own definitions repo — therefore gets no protection from it; a malformed definition surfaces later as a framework-internal error at composition time.Proposed change
Bind the validated definitions once and expose that through
lib, and key the retained check offflakeExposed:Footguns to encode as code comments
builtins.seqforces only weak-head-normal-form. That is enough to fire the current asserts, but if deeper validation is added later, forcing must upgrade tobuiltins.deepSeq. Note this at theseqcall.flakeExposedis ~30 systems:nix flake checkstill builds only the host entry, butnix flake show/--all-systemsnow evaluates all of them (slower) and the check nominally exists on darwin/riscv. Harmless, since the check is platform-independent — note that the breadth is deliberate and non-policy.lib.profileDefinitionsis a single guarded binding: any access forces the asserts. Keep it one checked value — do not later split it into lazily-exposed per-archetype sub-attrs, or the guarantee erodes. Note this at thelibbinding.Scope
In:
allod/profilesflake.nixonly. Noinventoryorsecretsinput; no change to composition behavior. Out: the single-owner rule for real machine-platform lists is unchanged and correct — this issue deliberately does not add an inventory input. It corrects the mechanism proposed in #2 (which would break the definitions-repo charter to fix a non-problem); #2 is closed in favor of this issue.