Repository navigation
feat(facter): add the caisson-facter and facter integrations - #97
Merged
Merged
Conversation
This was referenced Oct 17, 2026
clhodapp
force-pushed
the
feat/facter
branch
2 times, most recently
from
October 18, 2026 06:38
2af561b to
e2ee5ae
Compare
`caisson.exports.libOverlays`, `caisson.exports.pkgOverlays` and `caisson.libOverlays.exported` were attribute sets of an overlay type, so every evaluation merged each registered overlay as an option of its own, and the type check of the manifest walked every overlay and its imports. The exports are now merged once, joining the definitions with `//`, and an entry is checked when it is read. The check of the manifest no longer walks the overlays it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A caisson-facter configuration is the hardware of a machine: a module of the `caisson-facter` class with `facter.report`, the report nixos-facter writes, or `facter.reportPath`. caisson evaluates it with its own `evalModules`, so a project extends the class with options of its own about the hardware. The outputs are the report, checked against the report versions caisson knows, the report as a file, the configuration as data and its hash; every output fails with the messages of the class's `assertions`. The NixOS configurations declared inside it get caisson's NixOS module `caisson-facter-hardware`, which hands the report to nixpkgs' `hardware.facter.report`. A facter configuration is a `facter.json` as nixos-facter writes it, the `reportPath` of the `facter` class. The NixOS configurations declared inside it get `facter-hardware`, which sets nixpkgs' `hardware.facter.reportPath` to that file. Neither is published under an output attribute set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le defines them Re-export read `caisson.<integration>.exported` and `caisson.<integration>.configurations` for every integration in every full evaluation. It now reads them only for the integrations whose configurations a module of the evaluation defines, the integrations `childrenOf` already reads, found with the new `caisson.integrations.integrationsDeclaringIn`. An integration with no configurations declared passes nothing up whatever its selector selects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the native and the upstream-compatible facter integrations, and two cost fixes. This PR is based on #96. Merge #94, #95 and #96 first, then change the base of this PR to
main.The integrations
These are my reading of "caisson-facter and facter", which you haven't confirmed. They follow the caisson-disko pattern: the parent holds the hardware, and the NixOS configurations that run on it are declared inside it.
caisson-facter(classcaisson-facter) is the hardware of a machine.facter.report, the nixos-facter report as data, andfacter.reportPath, whichreportdefaults to. It also declaresassertions.evalModules, so a project can add options of its own about the hardware. ch-hardware's trust grammar could become such modules; ch-hardware is unchanged here.report, checked againstsupportedReportVersions(today[ 1 ]),reportFile,serializableConfig(the configuration as data without caisson's options) and itshash. Every output fails with the messages of the assertions that do not hold.caisson-facter-hardware, which sets nixpkgs'hardware.facter.reportatmkDefaultpriority.facter(classfacter) is afacter.jsonas nixos-facter writes it, named byreportPath, the only option of the class. Its machines getfacter-hardware, which sets nixpkgs'hardware.facter.reportPathto that file, the line a NixOS configuration written for nixos-facter carries.Neither is published under an output attribute set, because no tool reads a facter configuration from a flake.
The pinned-world test
facterHandsTheReportToNixpkgsdeclares one machine inside each integration, from the report of nixpkgs' own facter test. Each machine gets the same report and the same initrd kernel modules as anixosSystemthat setshardware.facter.reportPathitself, and the module list is checked to be non-empty. The test also checks that caisson-facter refuses a report of version 99 and a hardware an assertion refuses.The cost fixes
Before this PR, each integration added about 110 KB to caisson's overhead in the eval-weight check, mostly in every evaluation. At that rate the six integrations still planned for slice 6 would pass the 4.28 MB ceiling. This PR has two fixes for that.
perf(core):caisson.exports.libOverlays,caisson.exports.pkgOverlaysandcaisson.libOverlays.exportedwere attribute sets of an overlay type. So every evaluation merged each registered overlay as an option of its own, and the manifest's type check walked every overlay and its imports. These options are now merged once, by joining the definitions with//, and an entry is checked when it is read. The manifest check no longer walks the overlays.perf(integrations): re-export readexportedandconfigurationsfor every integration in every full evaluation. It now reads them only for the integrations whose configurations a module defines, found with the newcaisson.integrations.integrationsDeclaringIn, the same setchildrenOfreads.The ceiling is 4.28 MB and stays there.
Checks
nix flake checkpasses. All 18 workspace consumers passnix flake check --no-buildwith this branch in place of both caisson pins, the root input and thetests/dependencieslock. ch-system-manager is checked on clhodapp/ch-system-manager#15.🤖 Generated with Claude Code