Skip to content

den.lib

The angle bracket resolver. See Angle Brackets Syntax.

_module.args.__findFile = den.lib.__findFile;

Den aspects API. Provides aspect type definitions and internal resolution helpers.

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.

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.

Pipe builder API for quirk data routing. See den.quirks reference.

Create a named policy record for use in includes lists. See Policies reference.

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.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.

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>.

Returns an attrset of all host and home wrapper packages, suitable for perSystem.packages:

perSystem = { pkgs, ... }: {
packages = den.lib.nh.denPackages { fromFlake = true; } pkgs;
};

Returns a mkShell with nh and all wrapper scripts on PATH:

# Non-flake usage
options.den.sh = lib.mkOption {
default = den.lib.nh.denShell {
fromFlake = false;
outPrefix = [ "flake" ];
} pkgs;
};

Returns a list of all wrapper derivations (hosts + homes).

Returns a list of host-only wrapper derivations.

Returns a list of home-only wrapper derivations.

All functions take an args attrset:

FieldTypeDefaultDescription
fromFlakebooltrueUse flake ref (path#attr) or file ref (--file path attr)
fromPathstr"."Flake path or file path
outPrefixlist[]Prefix prepended to the output attribute path
defaultActionbuildstrThe 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:

Terminal window
# 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 --dry

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.

Contribute Community Sponsor