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`.
10 documentation-highlighter,
15 stdenvNoCC.mkDerivation (
18 inherit (finalAttrs.finalPackage.optionsDoc) optionsJSON;
19 inherit (finalAttrs.finalPackage) epub lib-docs pythonInterpreterTable;
22 name = "nixpkgs-manual";
24 nativeBuildInputs = [ nixos-render-docs ];
26 src = lib.fileset.toSource {
28 fileset = lib.fileset.unions [
29 (lib.fileset.fileFilter (file: file.hasExt "md" || file.hasExt "md.in") ../.)
39 ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
43 substituteInPlace ./languages-frameworks/python.section.md \
44 --subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"
47 ./functions/library.md.in \
48 ${lib-docs}/index.md \
49 > ./functions/library.md
50 substitute ./manual.md.in ./manual.md \
51 --replace-fail '@MANUAL_VERSION@' '${lib.version}'
55 mkdir -p out/highlightjs
56 cp -t out/highlightjs \
57 ${documentation-highlighter}/highlight.pack.js \
58 ${documentation-highlighter}/LICENSE \
59 ${documentation-highlighter}/mono-blue.css \
60 ${documentation-highlighter}/loader.js
62 cp -t out ./style.css ./anchor.min.js ./anchor-use.js
64 nixos-render-docs manual html \
65 --manpage-urls ./manpage-urls.json \
66 --redirects ./redirects.json \
67 --revision ${nixpkgs.rev or "master"} \
68 --stylesheet style.css \
69 --stylesheet highlightjs/mono-blue.css \
70 --script ./highlightjs/highlight.pack.js \
71 --script ./highlightjs/loader.js \
72 --script ./anchor.min.js \
73 --script ./anchor-use.js \
75 --section-toc-depth 1 \
81 dest="$out/share/doc/nixpkgs"
82 mkdir -p "$(dirname "$dest")"
84 mv "$dest/index.html" "$dest/manual.html"
86 cp ${epub} "$dest/nixpkgs-manual.epub"
88 mkdir -p $out/nix-support/
89 echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
90 echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
94 lib-docs = callPackage ./lib-function-docs.nix { inherit nixpkgs; };
96 epub = callPackage ./epub.nix { };
98 optionsDoc = callPackage ./options-doc.nix { };
100 pythonInterpreterTable = callPackage ./python-interpreter-table.nix { };
104 devmode' = devmode.override {
106 open = "/share/doc/nixpkgs/manual.html";
109 mkShellNoCC { packages = [ devmode' ]; };
111 tests.manpage-urls = callPackage ../tests/manpage-urls.nix { };