den.lib
den.lib.__findFile
Section titled “den.lib.__findFile”The angle bracket resolver. See Angle Brackets Syntax.
_module.args.__findFile = den.lib.__findFile;den.lib.aspects
Section titled “den.lib.aspects”Den aspects API. Provides aspect type definitions and internal resolution helpers.
den.lib.aspects.resolve class aspect
Section titled “den.lib.aspects.resolve class aspect”Internal. Resolves an aspect for a given class (e.g., "nixos"), returning a
module with imports. Runs the full pipeline including entity instantiation.
den.lib.aspects.resolveImports class aspect
Section titled “den.lib.aspects.resolveImports class aspect”Internal. Like resolve but skips entity instantiation (phase 4).
Use for nested resolution where only class imports are needed, such as
extracting homeManager modules from a host’s aspect tree.
den.lib.policy
Section titled “den.lib.policy”Policy effect constructors. See den.policies reference for the full API.
den.lib.policy.resolve, .include, .exclude, .route, .provide, .instantiate
Section titled “den.lib.policy.resolve, .include, .exclude, .route, .provide, .instantiate”Policy effect constructors used inside policy functions. See den.policies reference.
den.lib.policy.pipe
Section titled “den.lib.policy.pipe”Pipe builder API for quirk data routing. See den.quirks reference.
den.lib.policy.mkPolicy name fn
Section titled “den.lib.policy.mkPolicy name fn”Create a named policy record for use in includes lists.
See Policies reference.
den.lib.policy.for entity policyOrList
Section titled “den.lib.policy.for entity policyOrList”Conditional policy wrapper — fires only for a specific entity. See Policies.
den.lib.policy.when predicate policyOrList
Section titled “den.lib.policy.when predicate policyOrList”Conditional policy wrapper — fires only when predicate returns true. See Policies.
den.lib.policyInspect
Section titled “den.lib.policyInspect”den.lib.policyInspect.inspect { kind, context }
Section titled “den.lib.policyInspect.inspect { kind, context }”Lightweight policy inspection utility. Calls resolve functions directly without running the full pipeline. Returns matching policies with their targets and routing type.
See den.policies reference for full documentation.
den.lib.nh
Section titled “den.lib.nh”Generates nh wrapper scripts for each
host and home in your fleet. Each wrapper is a shell application that
calls nh os, nh darwin, or nh home with the correct flake
attribute, so you can build/switch with nix run .#<hostname>.
den.lib.nh.denPackages args pkgs
Section titled “den.lib.nh.denPackages args pkgs”Returns an attrset of all host and home wrapper packages, suitable for
perSystem.packages:
perSystem = { pkgs, ... }: { packages = den.lib.nh.denPackages { fromFlake = true; } pkgs;};den.lib.nh.denShell args pkgs
Section titled “den.lib.nh.denShell args pkgs”Returns a mkShell with nh and all wrapper scripts on PATH:
# Non-flake usageoptions.den.sh = lib.mkOption { default = den.lib.nh.denShell { fromFlake = false; outPrefix = [ "flake" ]; } pkgs;};den.lib.nh.denApps args pkgs
Section titled “den.lib.nh.denApps args pkgs”Returns a list of all wrapper derivations (hosts + homes).
den.lib.nh.hostApps args pkgs
Section titled “den.lib.nh.hostApps args pkgs”Returns a list of host-only wrapper derivations.
den.lib.nh.homeApps args pkgs
Section titled “den.lib.nh.homeApps args pkgs”Returns a list of home-only wrapper derivations.
All functions take an args attrset:
| Field | Type | Default | Description |
|---|---|---|---|
fromFlake | bool | true | Use flake ref (path#attr) or file ref (--file path attr) |
fromPath | str | "." | Flake path or file path |
outPrefix | list | [] | Prefix prepended to the output attribute path |
defaultAction | build | str | The default action to perform if no args are provided |
defaultArgs | [] | [str] | Additional default args to add to each invocation, e.g., --print-build-logs |
After adding denPackages to your perSystem.packages:
# Build igloo via nh (defaults to "build" action)$ nix run .#igloo
# Switch igloo via nh$ nix run .#igloo -- switch
# Any nh flags work$ nix run .#igloo -- switch --dryDeprecated functions
Section titled “Deprecated functions”Several den.lib functions are deprecated — the pipeline now handles
parametric dispatch and class module wrapping automatically. See
Deprecated den.lib functions for the full
listing.