docs/packages/options-doc/default.nix

33 lines
745 B
Nix
Raw Normal View History

2024-06-30 21:43:38 +00:00
{ pkgs, inputs, ... }:
2024-06-30 05:43:43 +00:00
let
inherit (pkgs.lib) hasPrefix removePrefix;
in
pkgs.nixosOptionsDoc {
inherit
(pkgs.lib.evalModules {
modules = [ "${inputs.nixpkgs.outPath}/pkgs/top-level/config.nix" ];
class = "nixpkgsConfig";
})
options
;
documentType = "none";
transformOptions =
opt:
opt
// {
declarations = map (
decl:
if hasPrefix (toString ../..) (toString decl) then
let
subpath = removePrefix "/" (removePrefix (toString ../.) (toString decl));
in
{
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
name = subpath;
}
else
decl
) opt.declarations;
};
}