From 2b392866d63cb5493119c4db294da1518d6261e2 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 1 Apr 2025 16:58:32 +0200 Subject: [PATCH] chore(buildClan): remove dependency on clan-core in the lib function --- lib/build-clan/default.nix | 25 +++++++++++++++++++++---- lib/default.nix | 3 +-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/build-clan/default.nix b/lib/build-clan/default.nix index f412bd038..b94bba48e 100644 --- a/lib/build-clan/default.nix +++ b/lib/build-clan/default.nix @@ -4,7 +4,6 @@ { lib, nixpkgs, - clan-core, }: let clanResultAttributes = [ @@ -20,10 +19,28 @@ in ./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 self ? lib.warn "Argument: 'self' must be set when using 'buildClan'." null, # Reference to the current flake @@ -33,7 +50,7 @@ in # deadnix: skip inventory ? { }, ## 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: diff --git a/lib/default.nix b/lib/default.nix index 1190541bd..53fd23021 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -23,9 +23,8 @@ lib.fix (clanLib: { buildClanModule = import ./build-clan { 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' inventory = clanLib.callLib ./inventory { };