den.ctx
den.ctx
Section titled “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.
Context Type Options
Section titled “Context Type Options”Each den.ctx.<name> has:
description
Section titled “description”Type: str
Human-readable description of this context type.
_ (alias: provides)
Section titled “_ (alias: provides)”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);includes
Section titled “includes”Aspect includes attached to this context type. Used by batteries to inject behavior at specific pipeline stages.
modules
Section titled “modules”Additional modules merged into the resolved output.
Built-in Context Types
Section titled “Built-in Context Types”den.ctx.host
Section titled “den.ctx.host”Context data: { host }
Produced for each den.hosts.<system>.<name> entry.
Providers:
_.host—fixedTo { host }on the host’s aspect._.user—atLeaston the host’s aspect with{ host, user }.
Transitions:
into.default— identity (for default aspect).into.user— one{ host, user }perhost.usersentry.into.hm-host— (fromhm-os.nix) if HM enabled and has HM users.into.wsl-host— (fromwsl.nix) if WSL enabled on NixOS host.into.hjem-host— (fromhjem-os.nix) if hjem enabled.into.maid-host— (frommaid-os.nix) if nix-maid enabled.
den.ctx.user
Section titled “den.ctx.user”Context data: { host, user }
Providers:
_.user—fixedTo { host, user }on the user’s aspect.
Transitions:
into.default— identity.
den.ctx.home
Section titled “den.ctx.home”Context data: { home }
Produced for each den.homes.<system>.<name> entry.
Providers:
_.home—fixedTo { home }on the home’s aspect.
den.ctx.hm-host
Section titled “den.ctx.hm-host”Context data: { host }
Providers:
provides.hm-host— imports HM OS module.
Transitions:
into.hm-user— per HM-class user.
den.ctx.hm-user
Section titled “den.ctx.hm-user”Context data: { host, user }
Providers:
_.hm-user— forwardshomeManagerclass tohome-manager.users.<userName>.
den.ctx.wsl-host
Section titled “den.ctx.wsl-host”Context data: { host }
Providers:
provides.wsl-host— imports WSL module, createswslclass forward.
Custom Context Types
Section titled “Custom Context Types”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; };}