2026-04-14 22:23:19 -07:00
|
|
|
{
|
|
|
|
|
pkgs,
|
|
|
|
|
suppressExperimentalWarnings ? false,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
jail:
|
2025-09-11 07:31:48 -07:00
|
|
|
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 =
|
2026-04-14 22:23:19 -07:00
|
|
|
acc: names: combinator:
|
2026-04-02 12:44:34 -07:00
|
|
|
if lib.length names == 0 then
|
|
|
|
|
acc
|
|
|
|
|
else
|
|
|
|
|
let
|
|
|
|
|
name = lib.head names;
|
2026-04-14 22:23:19 -07:00
|
|
|
combinatorImpl =
|
|
|
|
|
if combinator.experimental or false && !suppressExperimentalWarnings then
|
|
|
|
|
builtins.warn "jail.nix combinator ${name} is experimental!" combinator.impl
|
|
|
|
|
else
|
|
|
|
|
combinator.impl;
|
2026-04-02 12:44:34 -07:00
|
|
|
in
|
|
|
|
|
if acc ? ${name} then
|
|
|
|
|
throw "duplicate combinator ${name}"
|
|
|
|
|
else
|
2026-04-14 22:23:19 -07:00
|
|
|
foldCombinator (acc // { ${name} = combinatorImpl; }) (lib.tail names) combinator;
|
2026-04-02 12:44:34 -07:00
|
|
|
in
|
2026-04-14 22:23:19 -07:00
|
|
|
lib.foldl' (acc: { name, value }: foldCombinator acc ([ name ] ++ value.aliases or [ ]) value) { } (
|
|
|
|
|
lib.attrsToList rawCombinators
|
|
|
|
|
);
|
2025-10-04 09:34:19 -07:00
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
inherit combinators;
|
|
|
|
|
docs = rawCombinators;
|
2025-04-27 12:07:03 -07:00
|
|
|
}
|