1
0
Fork 0
mirror of https://github.com/NotAShelf/neovim-flake.git synced 2024-12-25 21:39:49 +01:00
neovim-flake/docs/manual.nix

64 lines
1.6 KiB
Nix
Raw Normal View History

2023-12-09 20:03:58 +01:00
{
lib,
2024-04-18 20:07:19 +02:00
stdenvNoCC,
# build inputs
nixos-render-docs,
2023-12-09 20:03:58 +01:00
documentation-highlighter,
path,
2024-04-18 20:07:19 +02:00
# nrd configuration
release,
optionsJSON,
2023-12-09 20:03:58 +01:00
}:
2024-04-18 20:07:19 +02:00
stdenvNoCC.mkDerivation {
name = "nvf-manual";
2024-04-20 05:57:11 +02:00
src = builtins.path {
2024-04-18 20:07:19 +02:00
path = lib.sourceFilesBySuffices ./manual [".md"];
name = "nvf-manual";
2024-04-20 05:57:11 +02:00
};
2023-12-09 20:03:58 +01:00
nativeBuildInputs = [nixos-render-docs];
buildPhase = ''
dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,media}
2023-12-09 20:03:58 +01:00
cp -vt $dest/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
substituteInPlace ./options.md \
--subst-var-by \
OPTIONS_JSON \
${optionsJSON}/share/doc/nixos/options.json
2023-12-09 20:03:58 +01:00
substituteInPlace ./manual.md \
--subst-var-by \
NVF_VERSION \
${release}
2023-12-09 20:03:58 +01:00
# copy stylesheet
cp ${./static/style.css} "$dest/style.css"
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 ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault release} \
--stylesheet style.css \
2024-04-20 05:57:11 +02:00
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 2 \
2024-04-20 05:58:39 +02:00
--section-toc-depth 1 \
2023-12-09 20:03:58 +01:00
manual.md \
"$dest/index.xhtml"
2023-12-09 20:03:58 +01:00
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
2023-12-09 20:03:58 +01:00
'';
}