den.lib Reference
import { Aside } from ‘@astrojs/starlight/components’;
den.lib.parametric
Section titled “den.lib.parametric”Creates a parametric aspect. Alias for parametric.withOwn parametric.atLeast.
den.lib.parametric { nixos.x = 1; includes = [ f ]; }Includes owned configs, statics, and dispatches to functions via atLeast.
parametric.atLeast
Section titled “parametric.atLeast”Dispatches only to functions whose required args are a subset of context:
F = parametric.atLeast { includes = [ a b ]; };parametric.exactly
Section titled “parametric.exactly”Dispatches only to functions whose args match context exactly:
F = parametric.exactly { includes = [ a b ]; };parametric.fixedTo
Section titled “parametric.fixedTo”Replaces context with a fixed attribute set:
F = parametric.fixedTo { x = 1; } aspect;parametric.expands
Section titled “parametric.expands”Merges extra attributes into received context:
F = parametric.expands { extra = 1; } aspect;parametric.withOwn
Section titled “parametric.withOwn”Combinator: adds owned + statics on top of a dispatch functor:
F = parametric.withOwn parametric.exactly aspect;den.lib.take
Section titled “den.lib.take”Individual function matching:
take.atLeast
Section titled “take.atLeast”den.lib.take.atLeast ({ host, ... }: { nixos.x = 1; })Wraps function to only be called when context has at least the required args.
take.exactly
Section titled “take.exactly”den.lib.take.exactly ({ host }: { nixos.x = 1; })Only called when context has exactly these args, no more.
take.unused
Section titled “take.unused”den.lib.take.unused ignored_value resultReturns result, ignoring the first argument. Used internally.
den.lib.canTake
Section titled “den.lib.canTake”Function signature introspection:
den.lib.canTake { x = 1; } someFunction# => true if someFunction can take at least { x }
den.lib.canTake.atLeast { x = 1; } someFunctionden.lib.canTake.exactly { x = 1; y = 2; } someFunctionden.lib.aspects
Section titled “den.lib.aspects”Re-export of flake-aspects library. Provides:
aspects.types.aspectsType— module type for aspect treesaspects.types.providerType— type for aspect providersaspects.forward— class forwarding implementation
den.lib.isFn
Section titled “den.lib.isFn”Checks if a value is callable (function or attrset with __functor):
den.lib.isFn someValue # => boolden.lib.owned
Section titled “den.lib.owned”Extracts only owned configs from an aspect (removes includes, __functor):
den.lib.owned someAspect # => { nixos = ...; darwin = ...; }den.lib.statics
Section titled “den.lib.statics”Creates a functor that only resolves static includes from an aspect:
den.lib.statics someAspect { class = "nixos"; aspect-chain = []; }den.lib.isStatic
Section titled “den.lib.isStatic”Checks if a function requires only { class, aspect-chain }:
den.lib.isStatic someFunction # => boolden.lib.__findFile
Section titled “den.lib.__findFile”Angle-bracket resolver. Translates <path> expressions to aspect lookups:
_module.args.__findFile = den.lib.__findFile;# then: <foo/bar> => den.aspects.foo.provides.bar