Skip to content

Give configurations their nearest children's defaults - #135

Merged
clhodapp merged 2 commits into
mainfrom
feat/for-nearest-children
Oct 25, 2026
Merged

clhodapp merged 2 commits into
mainfrom
feat/for-nearest-children

Conversation

@clhodapp

@clhodapp clhodapp commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

A default that a level adds through caisson.forChildren.extraDefaultModuleImports.<class> reaches every configuration of that class beneath the level, at any depth. Most of what a level gives says what the configurations directly beneath it live on, and that stops being true one machine further down. A NixOS configuration declared inside a colmena node inherited caisson/colmena-deployment and became a node. A machine inside a disk layout's machine inherited the layout's file systems. A machine inside a facter report's machine took the report's hardware as its own.

The option. caisson.forNearestChildren.extraDefaultModuleImports.<class> is a peer of the forChildren field with the same type. An addition made through it joins the defaults of the nearest configurations of that class beneath the level, passing through configurations of other classes such as a disk layout or a structural group. The configurations beneath those do not inherit it. The default account records such an addition like any other, with its key, level and file, plus nearest = true. An instance's moduleImports reset drops it like any default. The lifecycle side is nix-caisson/caisson-core#56.

Moved to it:

  • caisson/colmena-deployment, given by caisson-colmena
  • the layout entry of caisson-disko
  • the hardware modules given by caisson-facter and facter
  • the NixOS module of topology, which reads only its direct NixOS children

The parent modules of home-manager and hjem stay in forChildren, since each resolves its machine itself through nearest.

Which configuration an entry belongs to. lib.caisson.integrations.belongsHere type entry is true when no configuration of type lies between a level and an entry passed up to it. caisson-colmena's nodesOf keeps the NixOS configurations that belong to the colmena configuration, so a NixOS configuration declared inside a node is no node, and a node beneath a disk layout still is. The upstream-compatible colmena builds its hive through the same code.

Tests:

  • nixosConfigurationsInsideANodeAreNotNodes covers a node beneath a structural group and a disk layout. The node has deployment options. A NixOS configuration inside it, and one inside a plain node, are not nodes, have no deployment options and get no layout file systems. All of them are still published.
  • forNearestChildrenConnectsOnce checks that a nearest addition reaches the machines through a group and a layout but not the machines nested in them. It also checks that a forChildren addition still reaches every depth, and checks the account's entries.
  • A unit test covers belongsHere. No existing expectation changed.

Locally these pass: the pinned-world suite, nix-unit (200/200), nix flake check --no-build, eval-weight, argument-errors, treefmt and drift-message. caisson-core is pinned at 8f60ad7, the merge of caisson-core#56 on main, whose tree is the same as the branch these checks ran on. Every workspace consumer passes nix flake check --no-build against this branch.

🤖 Generated with Claude Code

…ults

A default a level adds through caisson.forChildren reaches every
configuration of its class beneath the level, at any depth. The
deployment options of a colmena node, the file systems of a disk
layout and the hardware of a facter report reached the machines
declared inside a node, a layout's machine or a report's machine too.

caisson.forNearestChildren.extraDefaultModuleImports.<class> adds to
the defaults of the nearest configurations of that class beneath the
level, through configurations of other classes, and no deeper. The
default account records such an addition with nearest = true. The
default modules of caisson-colmena, caisson-disko, caisson-facter,
facter and topology give their NixOS modules this way. The parent
modules of home-manager and hjem stay in forChildren, since they
resolve their machine themselves.

lib.caisson.integrations.belongsHere type entry says whether no
configuration of the type lies between a level and an entry passed
up to it. caisson-colmena's nodes are the NixOS configurations that
belong to the colmena configuration, so a NixOS configuration
declared inside a node is no node, and a node beneath a disk layout
still is.

caisson-core is pinned at 992db52, the branch of
nix-caisson/caisson-core#56, which this change needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp clhodapp self-assigned this Oct 25, 2026
nix-caisson/caisson-core#56 merged, so caisson-core moves from its
branch to the merge on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp
clhodapp merged commit e81cad9 into main Oct 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant