Skip to content

fix: mkInstanceRegistry supplies lib to its modules - #768

Merged
sini merged 1 commit into
mainfrom
fix/instance-registry-lib
Nov 13, 2026
Merged

sini merged 1 commit into
mainfrom
fix/instance-registry-lib

Conversation

@sini

@sini sini commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reported by @AlexLov in #766: a module in extraModules that takes lib works with den.lib.schema.mkInstanceType, but fails with den.lib.schema.mkInstanceRegistry:

error: gen-merge: a module read the module argument `lib' while its own declarations were being folded, …

den wraps gen-schema's mkInstanceType and mkSchemaOption so that every module gets nixpkgs' lib through specialArgs (withLib in nix/lib/schema.nix), and so that entity kinds get the resolved context module (withResolved). mkInstanceRegistry came through from gen-schema unwrapped, so a module asking for lib got nothing, and gen-merge's guard reported it as a declaration-stratum read.

This wraps mkInstanceRegistry the same way mkInstanceType is wrapped. A caller's own specialArgs still win, as with the other two.

The misleading message itself is gen-merge's; a clearer one is being worked on separately.

Validation

den wrapped gen-schema's mkInstanceType and mkSchemaOption with withLib
(and mkInstanceType with withResolved), but passed mkInstanceRegistry
through, so a registry module taking { lib, ... } was refused. Wrap it
the same way as mkInstanceType.

Reported in GitHub #766.
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label Nov 13, 2026
@sini sini changed the title fix(schema): mkInstanceRegistry supplies lib to its modules fix: mkInstanceRegistry supplies lib to its modules Nov 13, 2026
@sini
sini merged commit 9bdfbc2 into main Nov 13, 2026
17 of 18 checks passed
@sini
sini deleted the fix/instance-registry-lib branch November 13, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-ci allow all CI integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant