Reference Package schema
Package diagnostics
Package warnings and assertions evaluated with config, parts, and dependencies.
A package can report warnings and assertions about its evaluated configuration and resources:
warnings = { config, self, deps }: lib.optional (config.replicas == 1) "one replica leaves the service unavailable during an update";
assertions = { config, self, deps }: [ { assertion = config.port != 0; message = "port must not be zero"; }];Both attributes are optional functions. Kix calls them after package options, dependencies, build entries, and overlays have been evaluated.
Callback context
Section titled “Callback context”| Field | Value |
|---|---|
config | Evaluated package configuration for this instance. |
self | Final parts attribute set after build entries and overlays. |
deps | Resolved package-instance dependencies, keyed by build argument. |
deps contains dependencies resolved to managed instances or imports. Direct
values supplied through an instance’s deps do not appear in this context.
Warnings
Section titled “Warnings”warnings returns a list of strings. Kix prefixes each message with the
instance name and emits it as an evaluation trace. Warnings do not fail the
build.
Use a warning when Kix can still produce a valid cluster and the operator has a reasonable reason to keep the current value.
Assertions
Section titled “Assertions”assertions returns a list of Nix module-style assertions:
{ assertion = condition; message = "what is wrong and how to correct it";}Kix collects failed assertions across instances and reports them together. The instance name is added to each message. Assertions fail cluster evaluation, so use them for package contracts that cannot produce a valid or supported result.
Dependency-specific diagnostics
Section titled “Dependency-specific diagnostics”The package-level deps.<argument> entry can attach warnings and assertions
to one resolved dependency. Those callbacks receive the resolved argument
value directly and are skipped when an optional dependency is absent.
deps.storage.warnings = storage: lib.optional (kix.parseQuantity "memory" storage.out.size < 50 * 1024 * 1024 * 1024) "storage is smaller than the recommended 50Gi";