1 # This file describes the Nixpkgs manual, which happens to use module docs infra originally
2 # developed for NixOS. To build this derivation, run `nix-build -A nixpkgs-manual`.
8 documentation-highlighter,
13 stdenvNoCC.mkDerivation (
16 inherit (finalAttrs.finalPackage.optionsDoc) optionsJSON;
17 inherit (finalAttrs.finalPackage) epub lib-docs pythonInterpreterTable;
20 name = "nixpkgs-manual";
22 nativeBuildInputs = [ nixos-render-docs ];
24 src = lib.fileset.toSource {
26 fileset = lib.fileset.unions [
27 (lib.fileset.fileFilter (file: file.hasExt "md" || file.hasExt "md.in") ../.)
36 ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
40 substituteInPlace ./languages-frameworks/python.section.md \
41 --subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"
44 ./functions/library.md.in \
45 ${lib-docs}/index.md \
46 > ./functions/library.md
47 substitute ./manual.md.in ./manual.md \
48 --replace-fail '@MANUAL_VERSION@' '${lib.version}'
52 mkdir -p out/highlightjs
53 cp -t out/highlightjs \
54 ${documentation-highlighter}/highlight.pack.js \
55 ${documentation-highlighter}/LICENSE \
56 ${documentation-highlighter}/mono-blue.css \
57 ${documentation-highlighter}/loader.js
59 cp -t out ./style.css ./anchor.min.js ./anchor-use.js
61 nixos-render-docs manual html \
62 --manpage-urls ./manpage-urls.json \
63 --revision ${nixpkgs.rev or "master"} \
64 --stylesheet style.css \
65 --stylesheet highlightjs/mono-blue.css \
66 --script ./highlightjs/highlight.pack.js \
67 --script ./highlightjs/loader.js \
68 --script ./anchor.min.js \
69 --script ./anchor-use.js \
71 --section-toc-depth 1 \
77 dest="$out/share/doc/nixpkgs"
78 mkdir -p "$(dirname "$dest")"
80 mv "$dest/index.html" "$dest/manual.html"
82 cp ${epub} "$dest/nixpkgs-manual.epub"
84 mkdir -p $out/nix-support/
85 echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
86 echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
90 lib-docs = callPackage ./lib-function-docs.nix { inherit nixpkgs; };
92 epub = callPackage ./epub.nix { };
94 optionsDoc = callPackage ./options-doc.nix { };
96 pythonInterpreterTable = callPackage ./python-interpreter-table.nix { };
98 shell = callPackage ../../pkgs/tools/nix/web-devmode.nix {
100 open = "/share/doc/nixpkgs/manual.html";
103 tests.manpage-urls = callPackage ../tests/manpage-urls.nix { };