How-to guide / Debug dependency wiring
Inspect an instance's deps, parts, and out
Use the CLI for the rendered resource inventory and dependency graph. Use
nix eval when you need the package author’s raw parts or exported out
attributes.
Inspect rendered resources
Section titled “Inspect rendered resources”Start with kix inspect:
❱ kix inspect how-to-application Show outputHide output · 40 lines
Cluster: how-to-application
Total resources: 17
Namespaces (3):
(cluster-scoped) (5 resources)
how-to-app (10 resources)
kube-system (2 resources)
Resource kinds:
Kind Count
PackageInstance 4
ConfigMap 3
CustomResourceDefinition 2
Deployment 2
Namespace 2
Service 2
Activation 1
Job 1
Resources:
(cluster-scoped):
Activation/how-to-application-6rhi3wpk9iml
CustomResourceDefinition/activations.kix.run
CustomResourceDefinition/packageinstances.kix.run
Namespace/how-to-app
Namespace/kube-system
how-to-app:
ConfigMap/preview
ConfigMap/production
ConfigMap/production-health-script
Deployment/preview
Deployment/production
Job/production-health
PackageInstance/preview
PackageInstance/production
Service/preview
Service/production
kube-system:
PackageInstance/platform-dns
PackageInstance/platform-storage This output lists resources by namespace and kind. It does not show package
parts, resolved dependency bindings, or out values.
Inspect dependency edges
Section titled “Inspect dependency edges”Use kix graph to see the dependencies that affect deployment ordering:
❱ kix graph 08-namespace-deps --format tree Show outputHide output · 70 lines
CustomResourceDefinition/activations.kix.run
└── Activation/08-namespace-deps-zskpqs4dy1zn
CustomResourceDefinition/packageinstances.kix.run
├── PackageInstance/backend@platform
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── PackageInstance/platform-storage@kube-system (import)
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── PackageInstance/platform-dns@kube-system (import)
│ ├── Activation/08-namespace-deps-zskpqs4dy1zn
│ └── Deployment/gateway@app
│ └── Service/gateway@app
│ └── PackageInstance/gateway@app
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
└── PackageInstance/gateway@app
└── Activation/08-namespace-deps-zskpqs4dy1zn
Namespace/app
├── Service/gateway@app
│ └── PackageInstance/gateway@app
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── ConfigMap/gateway@app
│ └── Deployment/gateway@app
│ └── Service/gateway@app
│ └── PackageInstance/gateway@app
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── PackageInstance/gateway@app
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
└── Deployment/gateway@app
└── Service/gateway@app
└── PackageInstance/gateway@app
└── Activation/08-namespace-deps-zskpqs4dy1zn
Namespace/kube-system
├── PackageInstance/platform-storage@kube-system (import)
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
└── PackageInstance/platform-dns@kube-system (import)
├── Activation/08-namespace-deps-zskpqs4dy1zn
└── Deployment/gateway@app
└── Service/gateway@app
└── PackageInstance/gateway@app
└── Activation/08-namespace-deps-zskpqs4dy1zn
Namespace/platform
├── Service/backend@platform
│ ├── ConfigMap/gateway@app
│ │ └── Deployment/gateway@app
│ │ └── Service/gateway@app
│ │ └── PackageInstance/gateway@app
│ │ └── Activation/08-namespace-deps-zskpqs4dy1zn
│ └── PackageInstance/backend@platform
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── ConfigMap/backend@platform
│ └── Deployment/backend@platform
│ └── Service/backend@platform
│ ├── ConfigMap/gateway@app
│ │ └── Deployment/gateway@app
│ │ └── Service/gateway@app
│ │ └── PackageInstance/gateway@app
│ │ └── Activation/08-namespace-deps-zskpqs4dy1zn
│ └── PackageInstance/backend@platform
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
├── PackageInstance/backend@platform
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
└── Deployment/backend@platform
└── Service/backend@platform
├── ConfigMap/gateway@app
│ └── Deployment/gateway@app
│ └── Service/gateway@app
│ └── PackageInstance/gateway@app
│ └── Activation/08-namespace-deps-zskpqs4dy1zn
└── PackageInstance/backend@platform
└── Activation/08-namespace-deps-zskpqs4dy1zn
16 resources, 27 dependencies The graph is built from rendered manifests. It includes references carried by
resource values and explicit requires or extraDeps edges. A package build
argument by itself does not create an edge; the edge appears when a resource
uses an output from that dependency.
Use --format json when you need the machine-readable list of nodes and
edges:
❱ kix graph how-to-application --format json Inspect package parts
Section titled “Inspect package parts”kix.mkFlake exposes evaluated clusters under
legacyPackages.<system>.kixClusters (flakes that call buildCluster
directly without mkFlake do not define this output unless they export the
evaluated cluster themselves). The instance’s raw attribute is the
parts attrset returned by its package build function.
List the parts without forcing every resource into JSON:
❱ system=$(nix eval --impure --raw --expr builtins.currentSystem)❱ nix eval --json ".#legacyPackages.${system}.kixClusters.how-to-application" --apply 'cluster: builtins.attrNames cluster.instances."how-to-app".production.raw' For the example instance, the result includes content, deployment,
service, healthCheck, and root. Use a quoted attribute name whenever a
namespace or instance name contains a hyphen.
Inspect exported values
Section titled “Inspect exported values”List the public values on the package root:
❱ system=$(nix eval --impure --raw --expr builtins.currentSystem)❱ nix eval --json ".#legacyPackages.${system}.kixClusters.how-to-application" --apply 'cluster: builtins.attrNames cluster.instances."how-to-app".production.out' Then evaluate one serializable value directly:
❱ system=$(nix eval --impure --raw --expr builtins.currentSystem)❱ nix eval --raw ".#legacyPackages.${system}.kixClusters.how-to-application" --apply 'cluster: cluster.instances."how-to-app".production.out.name' Some out attributes are functions or carry Nix string context, so the whole
attrset may not serialize. List its keys first, then evaluate the scalar value
you need.