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