Skip to content

den.ctx (Compatibility Shim)

den.ctx was the original API for declaring aspects and binding them to entity resolution stages. It combined aspect definitions, cross-entity providers, and pipeline transitions in a single namespace.

The compatibility shim in modules/compat/ctx-shim.nix accepts den.ctx.* entries and forwards them:

den.ctx.<name> = { ... }
den.schema.<name>.includes = [ <value with deprecation warning> ]

Each forwarded value emits a lib.warn at evaluation time telling you exactly what to change.

The den.ctx namespace was split into three independent concerns:

Old (den.ctx)NewPurpose
den.ctx.<name> = { ... }den.aspects.<name> = { ... }Aspect definitions
den.ctx.<name>.into.<other>den.policies.<name>Entity topology (fan-out, routing)
den.ctx.<name>.provides.<other>den.schema.<kind>.includesCross-entity inclusion
Implicit activationden.schema.<kind>.includes = [ ... ]Explicit activation via includes

Before:

den.ctx.host = {
provides.host = { host }: den.aspects.${host.aspect};
into.user = { host }:
map (user: { inherit host user; }) (lib.attrValues host.users);
};

After:

# Aspect definition
den.aspects.my-aspect = { host }: {
nixos.services.foo.enable = true;
};
# Entity topology via policy
den.policies.host-to-users = { host, ... }:
map (user: policy.resolve.to "user" { inherit host user; })
(lib.attrValues host.users);
# Activation
den.schema.host.includes = [ den.aspects.my-aspect ];
Contribute Community Sponsor