Skip to content
kix /docs
Install the CLI

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.

root may instead be an attribute set:

root = {
resource = self.service;
requires = [ self.databaseMigration ];
postHooks = [ self.verify ];
out.url = "http://${self.service.out.fqdn}";
};
FieldTypeMeaning
resourceKix resourceMain resource for the instance. Required in the extended form.
requireslist of Kix resourcesAdditional resources included in the package’s forward closure and recorded on the PackageInstance. Default: [ ].
postHookslist of Kix resourcesResources included in the package’s forward closure and recorded separately on the PackageInstance. Default: [ ].
outattribute setPackage-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}";

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.