Files
Matt Sturgeon c7ccb896eb docs/man: simplify using structuredAttrs
Verified the output does not change:

$ nix build .#man-docs github:nix-community/nixvim#man-docs

$ sha256sum result{,-1}/share/man/man5/nixvim.5.gz
63177f4e1bff6db2ef01dfdb31c0674342ba9d9d27fe8e3d392bf86131fbc867  result/share/man/man5/nixvim.5.gz
63177f4e1bff6db2ef01dfdb31c0674342ba9d9d27fe8e3d392bf86131fbc867  result-1/share/man/man5/nixvim.5.gz
2026-06-22 20:38:34 +00:00

58 lines
1.3 KiB
Nix

{
options-json,
lib-docs,
runCommand,
installShellFiles,
nixos-render-docs,
pandoc,
}:
let
manHeader =
runCommand "nixvim-general-doc-manpage"
{
__structuredAttrs = true;
strictDeps = true;
nativeBuildInputs = [ pandoc ];
markdownSections = [
../user-guide/faq.md
../user-guide/config-examples.md
]
++ lib-docs.pages;
}
''
mkdir -p $out
{
cat ${./nixvim-header-start.5}
for file in "''${markdownSections[@]}"; do
pandoc --lua-filter ${./filter.lua} -f gfm -t man "$file"
done
cat ${./nixvim-header-end.5}
} >$out/nixvim-header.5
'';
in
# FIXME add platform specific docs to manpage
runCommand "nixvim-configuration-reference-manpage"
{
__structuredAttrs = true;
strictDeps = true;
nativeBuildInputs = [
installShellFiles
nixos-render-docs
];
header = manHeader;
footer = ./nixvim-footer.5;
}
''
# Generate man-pages
mkdir -p $out/share/man/man5
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision unstable \
--header "$header"/nixvim-header.5 \
--footer "$footer" \
${options-json}/share/doc/nixos/options.json \
$out/share/man/man5/nixvim.5
compressManPages $out
''