summaryrefslogtreecommitdiffstats
path: root/doc/default.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2023-03-25 21:38:26 +0100
committerpennae <github@quasiparticle.net>2023-07-01 20:59:29 +0200
commitbe4d19ff1a9a327ae805fdb344470ed6450256fc (patch)
treefa5f0b01cc0f081d16d3aef6d9af84c318151c00 /doc/default.nix
parentb521f451a3b2dcee1c72cd11a87d14249b125ce9 (diff)
doc: render nixpkgs manual with nrd
also updates nixdoc to 2.3.0. the nixdoc update is not a separate commit because that would leave the manual build broken for one commit, potentially breaking bisects and rebases.
Diffstat (limited to 'doc/default.nix')
-rw-r--r--doc/default.nix47
1 files changed, 33 insertions, 14 deletions
diff --git a/doc/default.nix b/doc/default.nix
index 485af9bd0af9..57066aabdaa9 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -47,13 +47,7 @@ in pkgs.stdenv.mkDerivation {
name = "nixpkgs-manual";
nativeBuildInputs = with pkgs; [
- pandoc
- graphviz
- libxml2
- libxslt
- zip
- jing
- xmlformat
+ nixos-render-docs
];
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
@@ -62,14 +56,43 @@ in pkgs.stdenv.mkDerivation {
ln -s ${doc-support} ./doc-support/result
'';
- preBuild = ''
- make -j$NIX_BUILD_CORES render-md
+ buildPhase = ''
+ cat \
+ ./functions/library.md.in \
+ ./doc-support/result/function-docs/index.md \
+ > ./functions/library.md
+ substitute ./manual.md.in ./manual.md \
+ --replace '@MANUAL_VERSION@' '${pkgs.lib.version}'
+
+ mkdir -p out/media
+
+ mkdir -p out/highlightjs
+ cp -t out/highlightjs \
+ ${pkgs.documentation-highlighter}/highlight.pack.js \
+ ${pkgs.documentation-highlighter}/LICENSE \
+ ${pkgs.documentation-highlighter}/mono-blue.css \
+ ${pkgs.documentation-highlighter}/loader.js
+
+ cp -t out ./overrides.css ./style.css
+
+ nixos-render-docs manual html \
+ --manpage-urls ./manpage-urls.json \
+ --revision ${pkgs.lib.trivial.revisionWithDefault (pkgs.rev or "master")} \
+ --stylesheet style.css \
+ --stylesheet overrides.css \
+ --stylesheet highlightjs/mono-blue.css \
+ --script ./highlightjs/highlight.pack.js \
+ --script ./highlightjs/loader.js \
+ --toc-depth 1 \
+ --section-toc-depth 1 \
+ manual.md \
+ out/index.html
'';
installPhase = ''
dest="$out/share/doc/nixpkgs"
mkdir -p "$(dirname "$dest")"
- mv out/html "$dest"
+ mv out "$dest"
mv "$dest/index.html" "$dest/manual.html"
cp ${epub} "$dest/nixpkgs-manual.epub"
@@ -78,8 +101,4 @@ in pkgs.stdenv.mkDerivation {
echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
'';
-
- # Environment variables
- PANDOC_LUA_FILTERS_DIR = "${pkgs.pandoc-lua-filters}/share/pandoc/filters";
- PANDOC_LINK_MANPAGES_FILTER = import build-aux/pandoc-filters/link-manpages.nix { inherit pkgs; };
}