From c26743c247ee3e0424c02a0a30afb04b944e46ba Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 10 Jun 2025 18:51:42 +0200 Subject: [PATCH] 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 --- flakeModules/clan.nix | 7 +++---- lib/build-clan/module.nix | 4 +++- lib/build-clan/public.nix | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/flakeModules/clan.nix b/flakeModules/clan.nix index 4c3456998..95892d721 100644 --- a/flakeModules/clan.nix +++ b/flakeModules/clan.nix @@ -13,16 +13,15 @@ let publicAttrs = import ../lib/build-clan/public.nix; # 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 = { clan = lib.genAttrs publicAttrs.clan ( - name: - config.clan.clanInternals.${name} - or (throw "Output: clanInternals.${name} not found. Check: ${config.file}") + name: config.clan.${name} or (throw "Output: clan.${name} not found.") ); topLevel = { options = lib.genAttrs publicAttrs.topLevel (_: lib.mkOption { }); 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.") ); }; }; diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 7df034d34..a3de32f2d 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -150,7 +150,9 @@ in 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; } ) { diff --git a/lib/build-clan/public.nix b/lib/build-clan/public.nix index cc302ac49..73e7978e4 100644 --- a/lib/build-clan/public.nix +++ b/lib/build-clan/public.nix @@ -5,7 +5,7 @@ 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 = [ "templates" "modules"