Fix(clan.nix): create public attributes from 'clan', dont expose them from clanInternals

ClanInternals is already exposed at the toplevel the API can access anything
This also deduplicated 'templates' and 'modules' into 'clan.modules' and 'clan.templates' repsectively
Only this one path is its source
This commit is contained in:
Johannes Kirschbauer
2025-06-10 18:51:42 +02:00
parent e322c92b2e
commit 78563b0544
3 changed files with 7 additions and 6 deletions

View File

@@ -13,16 +13,15 @@ let
publicAttrs = import ../lib/build-clan/public.nix; publicAttrs = import ../lib/build-clan/public.nix;
# Create output options only for listed attributes # Create output options only for listed attributes
# TODO: Refactor this into an explicit module, so we can have description and other attributes to be listed in flake-parts
outputModule = { outputModule = {
clan = lib.genAttrs publicAttrs.clan ( clan = lib.genAttrs publicAttrs.clan (
name: name: config.clan.${name} or (throw "Output: clan.${name} not found.")
config.clan.clanInternals.${name}
or (throw "Output: clanInternals.${name} not found. Check: ${config.file}")
); );
topLevel = { topLevel = {
options = lib.genAttrs publicAttrs.topLevel (_: lib.mkOption { }); options = lib.genAttrs publicAttrs.topLevel (_: lib.mkOption { });
config = lib.genAttrs publicAttrs.topLevel ( config = lib.genAttrs publicAttrs.topLevel (
name: config.clan.${name} or (throw "Output: clan.${name} not found. See: ${config.file}") name: config.clan.${name} or (throw "Output: clan.${name} not found.")
); );
}; };
}; };

View File

@@ -150,7 +150,9 @@ in
inventory._inventoryFile = file; inventory._inventoryFile = file;
} }
]; ];
inventory = inventoryLoaded; # Weirdly this works only if it is a function
# This seems to be a bug in nixpkgs
inventory = _: lib.setDefaultModuleLocation file inventoryLoaded;
} }
) )
{ {

View File

@@ -5,7 +5,7 @@
This list is used to guarantee equivalent attribute sets for both flake-parts and buildClan users. This list is used to guarantee equivalent attribute sets for both flake-parts and buildClan users.
*/ */
{ {
# flake.clan.{name} <- clanInternals.{name} # flake.clan.{name} <- clan.{name}
clan = [ clan = [
"templates" "templates"
"modules" "modules"