Skip to content

den.lib

Wraps an aspect with a __functor that filters includes by argument compatibility.

den.lib.parametric { nixos.x = 1; includes = [ ... ]; }

Default uses atLeast matching.

Same as parametric. Functions match if all required params are present.

Functions match only if required params exactly equal provided params.

den.lib.parametric.exactly { includes = [ ({ host }: ...) ]; }

Calls the aspect with a fixed context, ignoring the actual context:

den.lib.parametric.fixedTo { host = myHost; } someAspect

Extends the received context with additional attributes before dispatch:

den.lib.parametric.expands { extra = true; } someAspect

Low-level constructor. Takes a functor: self -> ctx -> aspect and wraps an aspect so that owned configs and statics are included at the static stage, and the functor runs at the parametric stage.

Function argument introspection.

Returns true if fn’s required arguments are satisfied by params (atLeast).

Same as canTake.

Returns true only if fn’s required arguments exactly match params.

Conditional function application.

Calls fn ctx if canTake.atLeast ctx fn, otherwise returns {}.

Calls fn ctx if canTake.exactly ctx fn, otherwise returns {}.

_unused: used: used — ignores first argument, returns second. Used for discarding aspect-chain in import-tree.

These helpers are shortcuts built with den.lib.take.exactly and den.lib.parametric.fixedTo:

Run aspect only in { host } contexts.

Run aspect only in { host, user } contexts.

Run aspect only in { home } contexts.

Extracts only static includes from an aspect (non-function includes):

den.lib.statics someAspect { class = "nixos"; aspect-chain = []; }

Extracts owned configs from an aspect (removes includes, __functor):

den.lib.owned someAspect

Returns true if the value is a function or has __functor:

den.lib.isFn myValue

Returns true if the function can take { class, aspect-chain }:

den.lib.isStatic myFn

The angle bracket resolver. See Angle Brackets Syntax.

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

Den aspects API. Provides aspect type definitions, resolve, resolve.withAdapter and basic adapters

Contribute Community Sponsor