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:
Johannes Kirschbauer
2025-04-04 18:50:56 +02:00
parent d472f0a174
commit 29fbf361a7
4 changed files with 47 additions and 24 deletions

View File

@@ -13,8 +13,14 @@
# { clanCore = «derivation JSON»; clanModules = { ${name} = «derivation JSON» }; }
jsonDocs = pkgs.callPackage ./get-module-docs.nix {
inherit (self) clanModules;
clan-core = self;
inherit pkgs;
evalClanModules = self.lib.evalClan.evalClanModules;
modulesRolesOptions = self.lib.evalClan.evalClanModulesWithRoles self.clanModules;
modulesRolesOptions = self.lib.evalClan.evalClanModulesWithRoles {
allModules = self.clanModules;
inherit pkgs;
clan-core = self;
};
};
# Frontmatter for clanModules

View File

@@ -4,6 +4,8 @@
clanModules,
evalClanModules,
lib,
pkgs,
clan-core,
}:
{
# clanModules docs
@@ -11,7 +13,12 @@
name: module:
if builtins.pathExists (module + "/default.nix") then
(nixosOptionsDoc {
options = ((evalClanModules [ module ]).options).clan.${name} or { };
options =
((evalClanModules {
modules = [ module ];
inherit pkgs clan-core;
}).options
).clan.${name} or { };
warningsAreErrors = true;
}).optionsJSON
else
@@ -31,7 +38,12 @@
clanCore =
(nixosOptionsDoc {
options = ((evalClanModules [ ]).options).clan.core or { };
options =
((evalClanModules {
modules = [ ];
inherit pkgs clan-core;
}).options
).clan.core or { };
warningsAreErrors = true;
}).optionsJSON;
}