This is a great refactor of the select functionality in the flake class. This now uses the same parser as the nix code, but runs it in python for nice stacktraces. Also we now have a maybe selector which can be used by prepending the selector with a ? Tests have been expanded to make sure the code is more stable and easier to understand
36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
{
|
|
lib,
|
|
self,
|
|
nixpkgs,
|
|
nix-darwin ? null,
|
|
...
|
|
}:
|
|
# Produces the
|
|
# 'clanLib' attribute set
|
|
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
|
|
lib.fix (clanLib: {
|
|
/**
|
|
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);
|
|
|
|
buildClan = clanLib.buildClanModule.buildClanWith {
|
|
clan-core = self;
|
|
inherit nixpkgs nix-darwin;
|
|
};
|
|
# ------------------------------------
|
|
# ClanLib functions
|
|
evalClan = clanLib.callLib ./inventory/eval-clan-modules { };
|
|
buildClanModule = clanLib.callLib ./build-clan { };
|
|
inventory = clanLib.callLib ./inventory { };
|
|
modules = clanLib.callLib ./inventory/frontmatter { };
|
|
test = clanLib.callLib ./test { };
|
|
|
|
# Plain imports.
|
|
values = import ./introspection { inherit lib; };
|
|
jsonschema = import ./jsonschema { inherit lib; };
|
|
select = self.inputs.nix-select.lib;
|
|
facts = import ./facts.nix { inherit lib; };
|
|
})
|