Reference Instance schema
config
Per-instance values evaluated against a package's typed options.
instances.apps.web = { package = packages.web; config = { replicas = 3; ingress.host = "web.example.com"; };};config supplies values for the options declared by the selected package.
Kix evaluates the result before calling the package’s build entries and
passes it to them as the config argument.
Schema
Section titled “Schema”| Property | Value |
|---|---|
| Type | deferred Nix module |
| Default | { } |
| Set at | instances.<namespace>.<name>.config |
Because config is a deferred module, several cluster modules may contribute
values to the same instance. Standard Nix module priorities apply:
instances.apps.web.config.replicas = lib.mkDefault 2;Use lib.mkForce only when the cluster must replace a package or module
default that otherwise has higher priority. Conflicting plain definitions
remain an evaluation error.
Sources and precedence
Section titled “Sources and precedence”Kix evaluates the following together:
- the package’s
optionsdeclarations and their defaults; - the package’s own top-level
configmodule; - configuration injected through the package-level
depscontract; and - every module contributed to the instance’s
config.
A package-level lib.mkDefault sits below values from the instance and from
dependency injection, even when those values also use lib.mkDefault. Types
and merge behavior come from the package’s option declarations. Unknown
fields and values of the wrong type fail evaluation.
An instance can use a module function when configuration depends on another value:
instances.apps.web.config = { config, ... }: { minAvailable = lib.mkDefault (config.replicas - 1);};