den.lib
den.lib.parametric
Section titled “den.lib.parametric”Wraps an aspect with a __functor that filters includes by argument compatibility.
den.lib.parametric { nixos.x = 1; includes = [ ... ]; }Default uses atLeast matching.
den.lib.parametric.atLeast
Section titled “den.lib.parametric.atLeast”Same as parametric. Functions match if all required params are present.
den.lib.parametric.exactly
Section titled “den.lib.parametric.exactly”Functions match only if required params exactly equal provided params.
den.lib.parametric.exactly { includes = [ ({ host }: ...) ]; }den.lib.parametric.fixedTo
Section titled “den.lib.parametric.fixedTo”Calls the aspect with a fixed context, ignoring the actual context:
den.lib.parametric.fixedTo { host = myHost; } someAspectden.lib.parametric.expands
Section titled “den.lib.parametric.expands”Extends the received context with additional attributes before dispatch:
den.lib.parametric.expands { extra = true; } someAspectden.lib.parametric.withOwn
Section titled “den.lib.parametric.withOwn”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.
den.lib.canTake
Section titled “den.lib.canTake”Function argument introspection.
den.lib.canTake params fn
Section titled “den.lib.canTake params fn”Returns true if fn’s required arguments are satisfied by params (atLeast).
den.lib.canTake.atLeast params fn
Section titled “den.lib.canTake.atLeast params fn”Same as canTake.
den.lib.canTake.exactly params fn
Section titled “den.lib.canTake.exactly params fn”Returns true only if fn’s required arguments exactly match params.
den.lib.take
Section titled “den.lib.take”Conditional function application.
den.lib.take.atLeast fn ctx
Section titled “den.lib.take.atLeast fn ctx”Calls fn ctx if canTake.atLeast ctx fn, otherwise returns {}.
den.lib.take.exactly fn ctx
Section titled “den.lib.take.exactly fn ctx”Calls fn ctx if canTake.exactly ctx fn, otherwise returns {}.
den.lib.take.unused
Section titled “den.lib.take.unused”_unused: used: used — ignores first argument, returns second. Used for
discarding aspect-chain in import-tree.
Context Shortcuts
Section titled “Context Shortcuts”These helpers are shortcuts built with den.lib.take.exactly and
den.lib.parametric.fixedTo:
den.lib.perHost aspect
Section titled “den.lib.perHost aspect”Run aspect only in { host } contexts.
den.lib.perUser aspect
Section titled “den.lib.perUser aspect”Run aspect only in { host, user } contexts.
den.lib.perHome aspect
Section titled “den.lib.perHome aspect”Run aspect only in { home } contexts.
den.lib.statics
Section titled “den.lib.statics”Extracts only static includes from an aspect (non-function includes):
den.lib.statics someAspect { class = "nixos"; aspect-chain = []; }den.lib.owned
Section titled “den.lib.owned”Extracts owned configs from an aspect (removes includes, __functor):
den.lib.owned someAspectden.lib.isFn
Section titled “den.lib.isFn”Returns true if the value is a function or has __functor:
den.lib.isFn myValueden.lib.isStatic
Section titled “den.lib.isStatic”Returns true if the function can take { class, aspect-chain }:
den.lib.isStatic myFnden.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, resolve, resolve.withAdapter and basic adapters