2023-11-06 11:52:30 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
modules,
|
|
|
|
}: let
|
|
|
|
nixvimPath = toString ./..;
|
|
|
|
|
|
|
|
gitHubDeclaration = user: repo: subpath: {
|
|
|
|
url = "https://github.com/${user}/${repo}/blob/master/${subpath}";
|
|
|
|
name = "<${repo}/${subpath}>";
|
|
|
|
};
|
2023-11-29 10:30:27 +01:00
|
|
|
in {
|
2023-11-06 11:52:30 +01:00
|
|
|
man-docs = let
|
|
|
|
eval = pkgs.lib.evalModules {
|
|
|
|
inherit modules;
|
|
|
|
};
|
|
|
|
|
|
|
|
options = pkgs.nixosOptionsDoc {
|
|
|
|
inherit (eval) options;
|
|
|
|
warningsAreErrors = false;
|
|
|
|
transformOptions = opt:
|
|
|
|
opt
|
|
|
|
// {
|
|
|
|
declarations =
|
|
|
|
map (
|
|
|
|
decl:
|
|
|
|
if pkgs.lib.hasPrefix nixvimPath (toString decl)
|
|
|
|
then
|
|
|
|
gitHubDeclaration "nix-community" "nixvim"
|
|
|
|
(pkgs.lib.removePrefix "/" (pkgs.lib.removePrefix nixvimPath (toString decl)))
|
|
|
|
else if decl == "lib/modules.nix"
|
|
|
|
then gitHubDeclaration "NixOS" "nixpkgs" decl
|
|
|
|
else decl
|
|
|
|
)
|
|
|
|
opt.declarations;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
pkgs.runCommand "nixvim-configuration-reference-manpage" {
|
2023-11-29 10:30:27 +01:00
|
|
|
nativeBuildInputs = with pkgs; [installShellFiles nixos-render-docs];
|
2023-11-06 11:52:30 +01:00
|
|
|
} ''
|
|
|
|
# Generate man-pages
|
|
|
|
mkdir -p $out/share/man/man5
|
2023-11-29 10:30:27 +01:00
|
|
|
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
2023-11-06 11:52:30 +01:00
|
|
|
--revision unstable \
|
2023-11-29 10:30:27 +01:00
|
|
|
--header ${./nixvim-header.5} \
|
|
|
|
--footer ${./nixvim-footer.5} \
|
2023-11-06 11:52:30 +01:00
|
|
|
${options.optionsJSON}/share/doc/nixos/options.json \
|
|
|
|
$out/share/man/man5/nixvim.5
|
2023-11-29 10:30:27 +01:00
|
|
|
compressManPages $out
|
2023-11-06 11:52:30 +01:00
|
|
|
'';
|
|
|
|
}
|