2026-06-08 17:38:35 -06:00
|
|
|
self: {
|
2026-05-12 15:34:14 +08:00
|
|
|
pkgs,
|
|
|
|
|
lib ? pkgs.lib,
|
|
|
|
|
module,
|
|
|
|
|
optionPrefix,
|
2026-06-08 17:38:35 -06:00
|
|
|
}: let
|
2026-05-13 11:06:59 +08:00
|
|
|
# Absolute store path of the flake root, used to compute relative subpaths
|
|
|
|
|
repoPath = toString self;
|
|
|
|
|
|
2026-05-12 15:34:14 +08:00
|
|
|
eval = lib.evalModules {
|
|
|
|
|
modules = [
|
|
|
|
|
(import module self)
|
2026-06-08 17:38:35 -06:00
|
|
|
{_module.check = false;}
|
2026-05-12 15:34:14 +08:00
|
|
|
];
|
2026-06-08 17:38:35 -06:00
|
|
|
specialArgs = {inherit pkgs;};
|
2026-05-12 15:34:14 +08:00
|
|
|
};
|
|
|
|
|
|
2026-05-13 11:06:59 +08:00
|
|
|
# Relative path of the module file within the repo (e.g. "nix/hm-modules.nix")
|
|
|
|
|
moduleSubpath = lib.removePrefix "/" (lib.removePrefix repoPath (toString module));
|
|
|
|
|
|
|
|
|
|
# Declaration entry linking each option back to its source file on GitHub
|
|
|
|
|
moduleDeclaration = {
|
|
|
|
|
url = "https://github.com/mangowm/mango/blob/main/${moduleSubpath}";
|
|
|
|
|
name = "<mango/${moduleSubpath}>";
|
|
|
|
|
};
|
|
|
|
|
|
2026-05-12 15:34:14 +08:00
|
|
|
optionsDoc = pkgs.nixosOptionsDoc {
|
|
|
|
|
options = eval.options;
|
2026-06-08 17:38:35 -06:00
|
|
|
transformOptions = opt:
|
2026-05-12 15:34:14 +08:00
|
|
|
opt
|
|
|
|
|
// {
|
|
|
|
|
visible = opt.visible && !opt.internal;
|
2026-05-13 11:06:59 +08:00
|
|
|
# Strip the option prefix so docs show "enable" instead of "programs.mango.enable"
|
2026-05-12 15:34:14 +08:00
|
|
|
name = lib.removePrefix optionPrefix opt.name;
|
2026-06-08 17:38:35 -06:00
|
|
|
declarations = [moduleDeclaration];
|
2026-05-12 15:34:14 +08:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
2026-06-08 17:38:35 -06:00
|
|
|
optionsDoc.optionsJSON
|