2025-09-11 07:31:48 -07:00
|
|
|
pkgs: jail:
|
|
|
|
|
let
|
2025-08-07 15:29:16 -07:00
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
helpers = import ./helpers.nix pkgs;
|
2025-04-27 12:07:03 -07:00
|
|
|
|
2026-04-02 12:44:34 -07:00
|
|
|
rawCombinators = lib.mapAttrs' (
|
|
|
|
|
fileName: _:
|
|
|
|
|
lib.nameValuePair (lib.removeSuffix ".nix" fileName) (
|
|
|
|
|
import ./combinators/${fileName} {
|
|
|
|
|
inherit
|
|
|
|
|
combinators
|
|
|
|
|
helpers
|
|
|
|
|
jail
|
|
|
|
|
lib
|
|
|
|
|
pkgs
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
) (builtins.readDir ./combinators);
|
|
|
|
|
|
|
|
|
|
combinators =
|
|
|
|
|
let
|
|
|
|
|
foldCombinator =
|
|
|
|
|
acc: names: combinatorImpl:
|
|
|
|
|
if lib.length names == 0 then
|
|
|
|
|
acc
|
|
|
|
|
else
|
|
|
|
|
let
|
|
|
|
|
name = lib.head names;
|
|
|
|
|
in
|
|
|
|
|
if acc ? ${name} then
|
|
|
|
|
throw "duplicate combinator ${name}"
|
|
|
|
|
else
|
|
|
|
|
foldCombinator (acc // { ${name} = combinatorImpl; }) (lib.tail names) combinatorImpl;
|
|
|
|
|
in
|
|
|
|
|
lib.foldl' (
|
|
|
|
|
acc: { name, value }: foldCombinator acc ([ name ] ++ value.aliases or [ ]) value.impl
|
|
|
|
|
) { } (lib.attrsToList rawCombinators);
|
2025-10-04 09:34:19 -07:00
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
inherit combinators;
|
|
|
|
|
docs = rawCombinators;
|
2025-04-27 12:07:03 -07:00
|
|
|
}
|