Skip to content

den.ctx

Type: lazyAttrsOf ctxType

A map of context type names to context type definitions. Each context type defines how data flows through the evaluation pipeline.

Each den.ctx.<name> has:

Type: str

Human-readable description of this context type.

Type: attrsOf providerType

Maps context names to provider functions. When this context is processed, each provider is called with the current context data and returns aspect fragments.

den.ctx.host._.host = { host }:
parametric.fixedTo { inherit host; } den.aspects.${host.aspect};

Type: lazyAttrsOf (functionTo (listOf raw))

Maps other context type names to transformation functions. Each function takes the current context data and returns a list of new context values.

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

Aspect includes attached to this context type. Used by batteries to inject behavior at specific pipeline stages.

Additional modules merged into the resolved output.

Context data: { host }

Produced for each den.hosts.<system>.<name> entry.

Providers:

  • _.hostfixedTo { host } on the host’s aspect.
  • _.useratLeast on the host’s aspect with { host, user }.

Transitions:

  • into.default — identity (for default aspect).
  • into.user — one { host, user } per host.users entry.
  • into.hm-host — (from hm-os.nix) if HM enabled and has HM users.
  • into.wsl-host — (from wsl.nix) if WSL enabled on NixOS host.
  • into.hjem-host — (from hjem-os.nix) if hjem enabled.
  • into.maid-host — (from maid-os.nix) if nix-maid enabled.

Context data: { host, user }

Providers:

  • _.userfixedTo { host, user } on the user’s aspect.

Transitions:

  • into.default — identity.

Context data: { home }

Produced for each den.homes.<system>.<name> entry.

Providers:

  • _.homefixedTo { home } on the home’s aspect.

Context data: { host }

Providers:

  • provides.hm-host — imports HM OS module.

Transitions:

  • into.hm-user — per HM-class user.

Context data: { host, user }

Providers:

  • _.hm-user — forwards homeManager class to home-manager.users.<userName>.

Context data: { host }

Providers:

  • provides.wsl-host — imports WSL module, creates wsl class forward.

Define new contexts to extend the pipeline:

{
den.ctx.gpu = {
description = "GPU-enabled host";
_.gpu = { host }: {
nixos.hardware.nvidia.enable = true;
};
};
den.ctx.host.into.gpu = { host }:
lib.optional (host ? gpu) { inherit host; };
}
Contribute Community Sponsor