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

69 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,
2024-04-18 20:07:19 +02:00
# nrd configuration
manpageUrls,
2023-12-09 20:03:58 +01:00
revision,
options,
outputPath ? "share/doc/nvf",
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 = ''
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
substituteInPlace ./options.md \
--subst-var-by \
OPTIONS_JSON \
${options.nvf}/share/doc/nixos/options.json
2023-12-09 20:03:58 +01:00
substituteInPlace ./manual.md \
--subst-var-by \
NVF_VERSION \
2023-12-09 20:03:58 +01:00
${revision}
# copy stylesheet
cp ${./static/style.css} out/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 \
2024-04-18 20:07:19 +02:00
--manpage-urls ${manpageUrls} \
2023-12-09 20:03:58 +01:00
--revision ${lib.trivial.revisionWithDefault revision} \
--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 \
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
'';
}