docs/nixpkgs-doc/options-doc.nix

33 lines
740 B
Nix
Raw Normal View History

2024-06-30 05:43:43 +00:00
{ pkgs, inputs }:
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;
};
}