Skip to content

den.lib Reference

import { Aside } from ‘@astrojs/starlight/components’;

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.

Dispatches only to functions whose required args are a subset of context:

F = parametric.atLeast { includes = [ a b ]; };

Dispatches only to functions whose args match context exactly:

F = parametric.exactly { includes = [ a b ]; };

Replaces context with a fixed attribute set:

F = parametric.fixedTo { x = 1; } aspect;

Merges extra attributes into received context:

F = parametric.expands { extra = 1; } aspect;

Combinator: adds owned + statics on top of a dispatch functor:

F = parametric.withOwn parametric.exactly aspect;

Individual function matching:

den.lib.take.atLeast ({ host, ... }: { nixos.x = 1; })

Wraps function to only be called when context has at least the required args.

den.lib.take.exactly ({ host }: { nixos.x = 1; })

Only called when context has exactly these args, no more.

den.lib.take.unused ignored_value result

Returns result, ignoring the first argument. Used internally.

Function signature introspection:

den.lib.canTake { x = 1; } someFunction
# => true if someFunction can take at least { x }
den.lib.canTake.atLeast { x = 1; } someFunction
den.lib.canTake.exactly { x = 1; y = 2; } someFunction

Re-export of flake-aspects library. Provides:

  • aspects.types.aspectsType — module type for aspect trees
  • aspects.types.providerType — type for aspect providers
  • aspects.forward — class forwarding implementation

Checks if a value is callable (function or attrset with __functor):

den.lib.isFn someValue # => bool

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

den.lib.owned someAspect # => { nixos = ...; darwin = ...; }

Creates a functor that only resolves static includes from an aspect:

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

Checks if a function requires only { class, aspect-chain }:

den.lib.isStatic someFunction # => bool

Angle-bracket resolver. Translates <path> expressions to aspect lookups:

_module.args.__findFile = den.lib.__findFile;
# then: <foo/bar> => den.aspects.foo.provides.bar