neovim-flake/docs/manual.nix

68 lines
1.6 KiB
Nix
Raw Normal View History

2023-12-09 20:03:58 +01:00
{
stdenv,
lib,
documentation-highlighter,
revision,
outputPath ? "share/doc/neovim-flake",
options,
nixos-render-docs,
}:
stdenv.mkDerivation {
name = "neovim-flake-manual";
2024-04-20 05:57:11 +02:00
src = builtins.path {
path = ./manual;
name = "neovim-flake-manual";
};
2023-12-09 20:03:58 +01:00
nativeBuildInputs = [nixos-render-docs];
buildPhase = ''
2024-04-20 05:57:11 +02:00
mkdir -p out/{highlightjs,media}
2023-12-09 20:03:58 +01:00
2024-04-20 05:57:11 +02:00
cp -vt out/highlightjs \
2023-12-09 20:03:58 +01:00
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
2024-04-20 05:57:11 +02:00
cp ${./static/style.css} out/style.css
2023-12-09 20:03:58 +01:00
substituteInPlace ./options.md \
2024-04-20 05:57:11 +02:00
--replace-fail \
2023-12-09 20:03:58 +01:00
'@OPTIONS_JSON@' \
${options.neovim-flake}/share/doc/nixos/options.json
substituteInPlace ./manual.md \
2024-04-20 05:57:11 +02:00
--replace-fail \
'@NVF_VERSION@' \
2023-12-09 20:03:58 +01:00
${revision}
2024-04-20 05:57:11 +02:00
# copy release notes
cp -vr ${./release-notes} release-notes
2023-12-09 20:03:58 +01:00
2024-04-20 05:57:11 +02:00
# generate manual from
2023-12-09 20:03:58 +01:00
nixos-render-docs manual html \
--manpage-urls ./manpage-urls.json \
--revision ${lib.trivial.revisionWithDefault revision} \
2024-04-20 05:57:11 +02:00
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
2023-12-09 20:03:58 +01:00
--stylesheet style.css \
--stylesheet highlightjs/tomorrow-night.min.css \
--stylesheet highlightjs/highlight-style.css \
2024-04-20 05:57:11 +02:00
--toc-depth 2 \
--section-toc-depth 2 \
2023-12-09 20:03:58 +01:00
manual.md \
out/index.xhtml
'';
installPhase = ''
dest="$out/${outputPath}"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}