Repository navigation
feat(terranix,system-manager): port to configurations evaluated per system - #96
Merged
Merged
Conversation
This was referenced Oct 17, 2026
…es them Every evaluation declares `caisson.modules.<class>.export.enabled` and `caisson.modules.<class>.exported` for every registered class, and merged both for every class to compute `caisson.exports.modules`. A class whose options no module defines now exports its default without the merge, and the types of the options are built once. `exported` is now a function to the modules as they are registered (`lazyAttrsOf raw`), so a default and a defined selection publish the same values; it no longer wraps each module in a deferred module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…system A terranix or system-manager configuration is now a configuration like the others: `mkConfiguration` returns a configuration a parent declares under `caisson.<integration>.configurations.<name>` or `mkTopConfiguration` finalizes, evaluated at every system in force. The module is found by name in `configs/terranix` or `configs/systemManager` when `configModule` is absent, and the entry points take no `pkgSets`. The modules get the composed library as `lib` and the package sets of the composition as `pkgSets`; the `inputs` argument is gone. A terranix configuration runs on the selected package set (`defaultPkgs`), its value and its `json` output are the `config.tf.json` file, and it is published as `terranixConfigurations.<name>`. caisson reads its own options back through terranix's `_meta`, so a terranix configuration holds no configurations beneath it. A system-manager configuration keeps building its own package set, with `nixpkgs.hostPlatform` defaulted to the system of the evaluation. Its value and its `toplevel` output are the system, published as `systemConfigs.<name>`, which `system-manager switch --flake` reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp
force-pushed
the
feat/terranix-system-manager
branch
from
October 18, 2026 05:39
ab0ed21 to
1adea7f
Compare
The port let `makeSystemConfig` build the package set from the nixpkgs system-manager pins, so the integration took no `defaultPkgs` and ignored the package configs and package overlays declared on `mkLib`. A system-manager configuration now runs on the selected set, as every other integration does, and on the nixpkgs the composition declares, as a NixOS configuration does. caisson calls system-manager's `nix/lib.nix`, the file its flake builds `lib.makeSystemConfig` from, with the composition's nixpkgs and the composed library, as the NixOS integration calls `nixos/lib/eval-config.nix`. The selected set is passed as the `pkgs` special argument. The module system takes a special argument before an entry of `_module.args`, so it is the `pkgs` of every module and the default of the read-only `nixpkgs.pkgs`, and the set system-manager would import is never evaluated. `userborn`, the fork system-manager pins, is built from that source on the selected set. `mkConfiguration` takes `defaultPkgs`. A configuration that sets `nixpkgs.overlays` or `nixpkgs.config`, or passes `overlays` in `ecosystemArgs`, is refused, since the selected set makes them ineffective, and so is one whose `nixpkgs.hostPlatform` differs from the platform of that set. The pinned-world test checks that the system runs on the declared set, through a marker only that set carries, and that its userborn is built on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp
force-pushed
the
feat/terranix-system-manager
branch
from
October 18, 2026 08:25
4b3b230 to
b8b9b1c
Compare
hjem is pronounced with a leading "y" sound, so it takes "a". 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.
terranix and system-manager were the last two integrations with the old shape, where
mkConfigurationreturned the evaluation directly, requiredconfigModuleand took apkgSetsattribute set. They now work like the other integrations. This PR is based on #95, which is based on #94. Merge those first, then change the base of this PR tomain. The repository does not delete merged branches, so GitHub does not change the base by itself.The port
mkConfigurationreturns a configuration. A parent declares it undercaisson.<integration>.configurations.<name>, ormkTopConfigurationfinalizes it at a top. It is evaluated per system, once for each system in force.configModuleis optional. When it is absent, the configuration registered under the declared name inconfigs/terranixorconfigs/systemManageris used.pkgSets. The modules get the composition's package sets at the system aspkgSetsand the composed library aslib. Theinputsargument, which nothing read, is gone.terranix:
defaultPkgs.jsonoutput are theconfig.tf.jsonfile, with the evaluated configuration underpassthru.config.terranixConfigurations.<name>, the name terranix's flake-parts module uses._meta, its documented out-of-band channel. A module of the integration copiesconfig.caissoninto_meta.caisson, and the integration reads it back from there. A terranix configuration therefore holds no configurations beneath it.system-manager:
defaultPkgs, else the set nameddefault), as every other integration does. It also runs on the nixpkgs the composition declares, as a NixOS configuration does.nix/lib.nix, the file its flake buildslib.makeSystemConfigfrom, with the composition's nixpkgs and the composed library. The NixOS integration callsnixos/lib/eval-config.nixthe same way.pkgsspecial argument. The module system takes a special argument before an entry of_module.args, so the selected set is thepkgsof every module and the default of the read-onlynixpkgs.pkgs.userborn, the fork system-manager pins, is built from that source on the selected set.nixpkgs.overlaysornixpkgs.config, or passesoverlaysinecosystemArgs, because the selected set makes them ineffective. So is one whosenixpkgs.hostPlatformdiffers from the platform of that set.topleveloutput are the system. It is published assystemConfigs.<name>, whichsystem-manager switch --flakereads, underdefaultwhen no name is given.nix.nixis unchanged.Both classes get caisson's
coremodule (modules/terranix/coreandmodules/systemManager/core, symlinks to the generic core, as for the other classes).The cost of two more classes
Each registered class declares
caisson.modules.<class>.export.enabledandcaisson.modules.<class>.exportedin every evaluation, andcaisson.exports.modulesmerged both for every class. The two new classes took caisson's overhead in the eval-weight check from 4.18 MB to 4.27 MB, against a ceiling of 4.28 MB. The first commit merges the options only for a class where a module defines them, and builds their types once. The overhead with this PR is 4.01 MB.As part of that change,
exportedis now a function returninglazyAttrsOf raw. Before, each exported module was wrapped in a deferred module ({ imports = [ … ]; }with a location string). Now the modules are exported exactly as the function returns them, so a default selection and a defined one publish the same values.Tests
passthruconfiguration. The system-manager test checks the platform. Both check that the modules see the composed library.ecosystemSrcValidationThrowsand the twin test use the new shape.pkgSets.Consumers
The only consumer is ch-system-manager, whose test flakes call the old shape. clhodapp/ch-system-manager#15 moves them to
mkTopConfigurationand declaressystemsonmkLib. Merge it after this PR.All 18 workspace consumers pass
nix flake check --no-buildwith this branch in place of caisson, ch-system-manager on that branch. This time the run also points each consumer'stests/dependencieslock at this branch, so the checks partitions, which read that lock, evaluate against it too. My earlier consumer runs for #91 through #95 overrode only the rootcaissoninput, so those partitions ran against the caisson they pin. This branch contains #94 and #95, so the run covers them as well.🤖 Generated with Claude Code