Files
clan-core/lib/docs.nix
Jörg Thalheim 0e97efbbef refactor: move docs transformOptions to clanLib to reduce rebuilds
- Add clanLib.docs.stripStorePathsFromDeclarations to deduplicate code
- Update all documentation generation to use the shared function
- This strips store paths from option declarations to prevent options.json
  from rebuilding when only store paths change but content remains the same
- Reduces unnecessary documentation rebuilds when making unrelated changes
2025-07-09 16:59:58 +02:00

21 lines
641 B
Nix

{ lib, ... }:
{
# Strip store paths from option declarations to make docs more stable
# This prevents documentation from rebuilding when store paths change
# but the actual content remains the same
stripStorePathsFromDeclarations = opt:
opt // {
declarations = map (decl:
if lib.isString decl && lib.hasPrefix "/nix/store/" decl then
let
parts = lib.splitString "/" decl;
in
if builtins.length parts > 4 then
"/" + lib.concatStringsSep "/" (lib.drop 4 parts)
else
decl
else
decl
) opt.declarations;
};
}