2024-04-16 17:06:45 +00:00
|
|
|
{
|
|
|
|
nixpkgs,
|
|
|
|
pkgs,
|
|
|
|
clanCore,
|
|
|
|
clanModules,
|
2024-04-17 10:52:04 +00:00
|
|
|
self,
|
2024-04-16 17:06:45 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
allNixosModules = (import "${nixpkgs}/nixos/modules/module-list.nix") ++ [
|
|
|
|
"${nixpkgs}/nixos/modules/misc/assertions.nix"
|
|
|
|
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
|
|
|
];
|
|
|
|
|
|
|
|
clanCoreNixosModules = [
|
|
|
|
clanCore
|
|
|
|
{ clanCore.clanDir = ./.; }
|
|
|
|
] ++ allNixosModules;
|
|
|
|
|
|
|
|
# TODO: optimally we would not have to evaluate all nixos modules for every page
|
|
|
|
# but some of our module options secretly depend on nixos modules.
|
|
|
|
# We would have to get rid of these implicit dependencies and make them explicit
|
|
|
|
clanCoreNixos = pkgs.nixos { imports = clanCoreNixosModules; };
|
|
|
|
|
|
|
|
# using extendModules here instead of re-evaluating nixos every time
|
|
|
|
# improves eval performance slightly (10%)
|
|
|
|
getOptions = modules: (clanCoreNixos.extendModules { inherit modules; }).options;
|
|
|
|
|
|
|
|
evalDocs =
|
|
|
|
options:
|
|
|
|
pkgs.nixosOptionsDoc {
|
|
|
|
options = options;
|
|
|
|
warningsAreErrors = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
# clanModules docs
|
|
|
|
clanModulesDocs = builtins.mapAttrs (
|
|
|
|
name: module: (evalDocs ((getOptions [ module ]).clan.${name} or { })).optionsJSON
|
|
|
|
) clanModules;
|
|
|
|
|
2024-04-17 10:52:04 +00:00
|
|
|
clanModulesReadmes = builtins.mapAttrs (
|
2024-05-01 21:16:17 +00:00
|
|
|
module_name: _module: self.lib.modules.getDescription module_name
|
2024-04-17 10:52:04 +00:00
|
|
|
) clanModules;
|
|
|
|
|
2024-04-16 17:06:45 +00:00
|
|
|
# clanCore docs
|
|
|
|
clanCoreDocs = (evalDocs (getOptions [ ]).clanCore).optionsJSON;
|
|
|
|
in
|
|
|
|
{
|
2024-04-17 10:52:04 +00:00
|
|
|
inherit clanModulesReadmes;
|
2024-04-16 17:06:45 +00:00
|
|
|
clanCore = clanCoreDocs;
|
|
|
|
clanModules = clanModulesDocs;
|
|
|
|
}
|