chore(buildClan): remove dependency on clan-core in the lib function

This commit is contained in:
Johannes Kirschbauer
2025-04-01 16:58:32 +02:00
parent 3fab3e60d7
commit 2b392866d6
2 changed files with 22 additions and 6 deletions

View File

@@ -4,7 +4,6 @@
{ {
lib, lib,
nixpkgs, nixpkgs,
clan-core,
}: }:
let let
clanResultAttributes = [ clanResultAttributes = [
@@ -20,10 +19,28 @@ in
./module.nix ./module.nix
]; ];
}; };
/** /**
Function that returns the same result as the correlated flake-parts module A function that takes some arguments such as 'clan-core' and returns the 'buildClan' function.
# Arguments of the first function
- clan-core: Self, provided by our flake-parts module
# Arguments of the second function (aka 'buildClan')
- self: Reference to the users flake
- inventory: An "Inventory" attribute set, see the docs, for how to construct one
- specialArgs: Extra arguments to pass to nixosSystem i.e. useful to make self available
- ...: Any other argument of the 'clan' submodule. See the docs for all available options
# Returns
A module evaluation containing '.config' and '.options'
NOTE:
The result might export all kinds of options at the '.config' top level.
*/ */
buildClan = buildClanWith =
{ clan-core }:
{ {
## Inputs ## Inputs
self ? lib.warn "Argument: 'self' must be set when using 'buildClan'." null, # Reference to the current flake self ? lib.warn "Argument: 'self' must be set when using 'buildClan'." null, # Reference to the current flake
@@ -33,7 +50,7 @@ in
# deadnix: skip # deadnix: skip
inventory ? { }, inventory ? { },
## Special inputs (not passed to the module system as config) ## Special inputs (not passed to the module system as config)
specialArgs ? { }, # Extra arguments to pass to nixosSystem i.e. useful to make self available # A set containing clan meta: name :: string, icon :: string, description :: string specialArgs ? { }, # Extra arguments to pass to nixosSystem i.e. useful to make self available
## ##
... ...
}@attrs: }@attrs:

View File

@@ -23,9 +23,8 @@ lib.fix (clanLib: {
buildClanModule = import ./build-clan { buildClanModule = import ./build-clan {
inherit lib nixpkgs; inherit lib nixpkgs;
clan-core = self;
}; };
buildClan = clanLib.buildClanModule.buildClan; buildClan = clanLib.buildClanModule.buildClanWith { clan-core = self; };
# ------------------------------------ # ------------------------------------
# Lib functions that don't depend on 'self' # Lib functions that don't depend on 'self'
inventory = clanLib.callLib ./inventory { }; inventory = clanLib.callLib ./inventory { };