chore(lib/modulesDocs): move dependency on clan-core and pkgs into function args
This is a good idea, to make lib agnostic from clan-core The next step could be to rename the clan-core argument name Or to explizitly pass the actual dependencies, instead of everything in clan-core
This commit is contained in:
@@ -9,25 +9,21 @@
|
||||
# 'clanLib' attribute set
|
||||
# Wrapped with fix, so we can depend on other clanLib functions without passing the whole flake
|
||||
lib.fix (clanLib: {
|
||||
# TODO:
|
||||
# SSome bad lib functions that depend on something in 'self'.
|
||||
# We should reduce the dependency on 'self' aka the 'flake' object
|
||||
# This makes it easier to test
|
||||
# most of the time passing the whole flake is unnecessary
|
||||
/**
|
||||
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);
|
||||
|
||||
evalClan = import ./inventory/eval-clan-modules {
|
||||
inherit lib;
|
||||
clan-core = self;
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
};
|
||||
buildClanModule = clanLib.callLib ./build-clan { inherit nixpkgs nix-darwin; };
|
||||
|
||||
buildClan = clanLib.buildClanModule.buildClanWith { clan-core = self; };
|
||||
# ------------------------------------
|
||||
# Lib functions that don't depend on 'self'
|
||||
# ClanLib functions
|
||||
evalClan = clanLib.callLib ./inventory/eval-clan-modules { };
|
||||
buildClanModule = clanLib.callLib ./build-clan { inherit nixpkgs nix-darwin; };
|
||||
inventory = clanLib.callLib ./inventory { };
|
||||
modules = clanLib.callLib ./inventory/frontmatter { };
|
||||
|
||||
# Plain imports.
|
||||
values = import ./introspection { inherit lib; };
|
||||
jsonschema = import ./jsonschema { inherit lib; };
|
||||
select = import select/default.nix;
|
||||
|
||||
Reference in New Issue
Block a user