Reference Package schema
root
The resource that represents a package instance in the deployment graph.
Every package build must return root. It identifies the main resource for
the package instance and anchors the resources that belong to the package.
build = { self, scope, ... }: { deployment = scope.mkDeployment { name = scope.instanceName; };
root = self.deployment;};The root resource must also appear under a named part such as deployment.
root is a pointer, not a resource slot: a resource assigned only to root
is excluded from manifest collection, and Kix rejects the package.
Extended form
Section titled “Extended form”root may instead be an attribute set:
root = { resource = self.service; requires = [ self.databaseMigration ]; postHooks = [ self.verify ]; out.url = "http://${self.service.out.fqdn}";};| Field | Type | Meaning |
|---|---|---|
resource | Kix resource | Main resource for the instance. Required in the extended form. |
requires | list of Kix resources | Additional resources included in the package’s forward closure and recorded on the PackageInstance. Default: [ ]. |
postHooks | list of Kix resources | Resources included in the package’s forward closure and recorded separately on the PackageInstance. Default: [ ]. |
out | attribute set | Package-level outputs merged into the root resource’s out. Default: { }. |
The CLI currently does not apply special scheduling behavior to
kix.run/package-requires or kix.run/post-hooks. Both lists make their
resources dependencies of the PackageInstance through the ordinary graph.
In particular, postHooks does not currently guarantee that a resource runs
after the rest of the package.
Package-level outputs are exposed to consumers as
<dependency>.out.<name>. Prefer outputs derived from resource out fields,
because their Nix string context records the dependency:
out.endpoint = "http://${self.service.out.fqdn}:${toString self.service.out.port}";Reachability
Section titled “Reachability”Kix follows dependencies forward from the root, its package-level
requires, and its post-hooks. A named resource outside that reachable set
produces an orphan warning. Connect it through an out value, a manifest
field carrying resource context, or an explicit requires entry.
A post-hook should depend on the root or on a resource the root requires. Kix warns when that dependency is absent.