Skip to content

Generate the module and configuration types of every integration - #148

Merged
clhodapp merged 1 commit into
mainfrom
feat/generated-integration-types
Nov 11, 2026
Merged

clhodapp merged 1 commit into
mainfrom
feat/generated-integration-types

Conversation

@clhodapp

@clhodapp clhodapp commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

mkIntegration now builds lib.caisson.<integration>.types for every integration from its name and its class, as it builds mkModule from the class. No integration adds anything for it.

  • types.module is the option type of a module of the class. It is the deferredModule type of nixpkgs, and it refuses a definition whose module states another class. A module states its class with _class. A module read from the registry states it in its key, modules.<class>.<name>@<project>. A function or a path states no class, and the type takes it unchecked.
  • types.configuration takes what the mkConfiguration of the integration returns, or a deferred configuration. When the configuration is finalized, the type reads the type of its manifest and refuses a configuration of another integration. It forces nothing more of the manifest.
  • An alt integration (nixos-minimal, home-manager-minimal) carries the types of its owner.

caisson.<integration>.configurations is now a lazy attribute set of that configuration type. A configuration of the wrong integration fails at the option, and the message names the option and the file of the definition:

error: `caisson.flake-parts.configurations.inner` in `/example/parent.nix`
is defined with a structural configuration, and the option takes a
flake-parts configuration. Declare it under `caisson.structural.configurations`.

The option types of the core module (libOverlay, pkgOverlay, libOverlays, pkgOverlays, manifest) move from lib.caisson.flake-parts.types to lib.caisson-core.types. The integrations overlay of caisson adds them to that namespace. caisson-core is written on builtins alone, and an option type is built on the library of nixpkgs, so caisson-core itself needs no change.

No repository in the workspace, topside or the site reads lib.caisson.flake-parts.types. The site documents it, and nix-caisson/nix-caisson.github.io gets its own PR.

Evaluation cost on ch-personal-machines, with every caisson pin of its lock overridden to caisson main and then to this branch (NIX_SHOW_STATS). Both evaluations produce the same drvPath.

main this branch
chris-desktop-2 toplevel, thunks 52,795,660 52,860,356
chris-desktop-2 toplevel, function calls 34,119,909 34,133,365
chris-desktop-2 toplevel, GC heap 3,355,705,344 3,355,705,344
chris@chris-desktop-2 home, thunks 42,246,728 42,311,424
chris@chris-desktop-2 home, function calls 27,254,465 27,267,921
chris@chris-desktop-2 home, GC heap 2,567,176,192 2,567,176,192
chris-desktop-2 toplevel, CPU seconds (two runs) 25.5, 28.1 32.6, 26.8
chris@chris-desktop-2 home, CPU seconds (two runs) 23.9, 25.5 27.7, 25.9

Each evaluation allocates about 65,000 more thunks, 0.12 % of the toplevel. The CPU times differ from run to run by more than they differ between the branches, on a machine with a load average near 6.

nix-caisson/topside#11 updates the topside goldens, which list the names of each namespace. nix-caisson/nix-caisson.github.io#93 updates the reference.

nix flake check passes locally, VM checks included.

🤖 Generated with Claude Code

`mkIntegration` builds `lib.caisson.<integration>.types` from the name
and the class of the integration, as it builds `mkModule` from the
class. `types.module` is the `deferredModule` type of nixpkgs, and it
refuses a module that states another class, by `_class` or by the key
of a registry entry. `types.configuration` takes what the
`mkConfiguration` of the integration returns, and it refuses a
configuration of another integration when the configuration is
finalized. An alt integration carries the types of its owner.

`caisson.<integration>.configurations` takes entries of that
configuration type, so the refusal names the option and the file that
define the entry.

The option types of the core module move from
`lib.caisson.flake-parts.types` to `lib.caisson-core.types`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp clhodapp self-assigned this Nov 11, 2026
@clhodapp
clhodapp merged commit dbcdf33 into main Nov 11, 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