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-09-22 21:52:10 +02:00
|
|
|
path,
|
2024-04-18 20:07:19 +02:00
|
|
|
# nrd configuration
|
2024-09-22 21:52:10 +02:00
|
|
|
release,
|
|
|
|
optionsJSON,
|
2023-12-09 20:03:58 +01:00
|
|
|
}:
|
2024-04-18 20:07:19 +02:00
|
|
|
stdenvNoCC.mkDerivation {
|
2024-04-27 14:44:37 +02:00
|
|
|
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"];
|
2024-04-27 14:44:37 +02:00
|
|
|
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-09-22 21:52:10 +02:00
|
|
|
dest="$out/share/doc/nvf"
|
|
|
|
mkdir -p "$(dirname "$dest")"
|
|
|
|
mkdir -p $dest/{highlightjs,media}
|
2023-12-09 20:03:58 +01:00
|
|
|
|
2024-09-22 21:52:10 +02: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 \
|
2024-04-20 06:45:49 +02:00
|
|
|
--subst-var-by \
|
|
|
|
OPTIONS_JSON \
|
2024-09-22 21:52:10 +02:00
|
|
|
${optionsJSON}/share/doc/nixos/options.json
|
2023-12-09 20:03:58 +01:00
|
|
|
|
|
|
|
substituteInPlace ./manual.md \
|
2024-04-20 06:45:49 +02:00
|
|
|
--subst-var-by \
|
|
|
|
NVF_VERSION \
|
2024-09-22 21:52:10 +02:00
|
|
|
${release}
|
2023-12-09 20:03:58 +01:00
|
|
|
|
2024-04-20 06:45:49 +02:00
|
|
|
# copy stylesheet
|
2024-09-22 21:52:10 +02:00
|
|
|
cp ${./static/style.css} "$dest/style.css"
|
2023-12-31 08:07:30 +01:00
|
|
|
|
2024-04-20 05:57:11 +02:00
|
|
|
# copy release notes
|
2023-12-31 08:07:30 +01:00
|
|
|
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-09-22 21:52:10 +02:00
|
|
|
--manpage-urls ${path + "/doc/manpage-urls.json"} \
|
|
|
|
--revision ${lib.trivial.revisionWithDefault release} \
|
2024-04-20 06:45:49 +02:00
|
|
|
--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 \
|
2024-09-22 21:52:10 +02:00
|
|
|
"$dest/index.xhtml"
|
2023-12-09 20:03:58 +01:00
|
|
|
|
2024-09-22 21:52:10 +02: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
|
|
|
'';
|
|
|
|
}
|