Skip to content
Victor Borja edited this page Feb 6, 2026 · 4 revisions

Intent Contexts

Den uses intent contexts to determine which configuration modules to include. An intent context is an attribute set passed to parametric aspects, and the attribute names determine which functions get called.

OS Configuration Context: { OS, host }

When building an OS configuration (NixOS or Darwin), Den starts with the context { OS, host }:

  • OS - Self-reference to the aspect being applied
  • host - The host configuration from den.hosts.<system>.<name>

Home-Managed User Context: { HM, user, host }

For users with home-manager integration on a host, the context expands to include user data:

  • HM - Reference to the user's home-manager aspect
  • user - The user configuration from host.users.<name>
  • host - The host the user belongs to

Standalone Home-Manager Context: { HM, home }

For standalone home-manager configurations (not attached to a host):

  • HM - Reference to the home aspect
  • home - The home configuration from den.homes.<system>.<name>

Context Detection: { HM-OS-HOST }

Den provides a special context for detecting hosts that have home-manager enabled:

  • HM-OS-HOST - Only present for hosts with HM-supported OS and at least one homeManager-class user

Working Example: See hm-enabled-host.nix for using HM-OS-HOST context to conditionally configure hosts.

Creating Custom Contexts

You can create your own contexts for specialized dependency handling. Any attribute set can serve as a context - the key is matching the required arguments of your parametric functions.

Working Example: See parametric-with-owned.nix for advanced context manipulation with fixedTo and expands.

Clone this wiki locally