Files
clan-core/lib/default.nix
Johannes Kirschbauer daea2da358 lib: move clan out of lib into flake
This allows clanLib to stay agnostic and be more testable
2025-09-16 15:28:12 +02:00

43 lines
1.4 KiB
Nix

{
lib,
...
}:
# Produces the
# 'clanLib' attribute set
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
lib.fix (
let
f = clanLib: {
__unfix__ = f;
clan = throw "lib.clan is not yet initialized. Use lib.clan exported by the clan-core flake.";
/**
Like callPackage, but doesn't try to automatically detect arguments
'lib' and 'clanLib' are always passed, plus the additional arguments
*/
callLib = file: args: import file ({ inherit lib clanLib; } // args);
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
# ------------------------------------
# ClanLib functions
inventory = clanLib.callLib ./modules/inventory { };
test = clanLib.callLib ./test { };
flake-inputs = clanLib.callLib ./flake-inputs.nix { };
# Custom types
types = clanLib.callLib ./types { };
# Plain imports.
introspection = import ./introspection { inherit lib; };
jsonschema = import ./jsonschema { inherit lib; };
facts = import ./facts.nix { inherit lib; };
docs = import ./docs.nix { inherit lib; };
# flakes
flakes = clanLib.callLib ./flakes.nix { };
# TODO: Flatten our lib functions like this:
resolveModule = clanLib.callLib ./resolve-module { };
};
in
f
)