smooooth/nix/docs.nix
2025-05-25 20:07:35 +10:00

47 lines
1.0 KiB
Nix

{
pkgs,
lib,
ndg-builder,
}:
let
eval = lib.evalModules {
specialArgs = { inherit pkgs; };
modules = [
./module.nix
];
};
optionsDoc = pkgs.nixosOptionsDoc {
inherit (eval) options;
transformOptions =
opt:
opt
// {
# Clean up declaration sites to not refer to the source tree.
declarations =
let
devDir = toString /home/bolt/code/smooooth;
inherit (lib) hasPrefix removePrefix;
in
map (
decl:
if hasPrefix (toString devDir) (toString decl) then
let
subpath = removePrefix "/" (removePrefix (toString devDir) (toString decl));
in
{
url = "https://git.atagen.co/atagen/smooooth/${subpath}";
name = subpath;
}
else
decl
) opt.declarations;
};
};
in
ndg-builder.override {
title = "smooooth documentation";
rawModules = [ ./module.nix ];
}