2018-10-05 14:46:58 +00:00
|
|
|
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
|
2015-12-19 15:04:36 +00:00
|
|
|
let
|
2024-07-26 17:50:26 +00:00
|
|
|
inherit (pkgs) lib callPackage;
|
2024-06-14 18:33:43 +00:00
|
|
|
fs = lib.fileset;
|
2023-06-22 23:03:02 +00:00
|
|
|
|
2023-07-13 09:16:28 +00:00
|
|
|
common = import ./common.nix;
|
|
|
|
|
2024-07-26 17:50:26 +00:00
|
|
|
lib-docs = callPackage ./doc-support/lib-function-docs.nix {
|
|
|
|
inherit nixpkgs;
|
2023-06-23 00:02:57 +00:00
|
|
|
};
|
2023-06-24 19:39:20 +00:00
|
|
|
|
2024-07-26 17:56:06 +00:00
|
|
|
epub = callPackage ./doc-support/epub.nix { };
|
2023-06-22 23:03:02 +00:00
|
|
|
|
2024-07-26 18:07:58 +00:00
|
|
|
# NB: This file describes the Nixpkgs manual, which happens to use module docs infra originally developed for NixOS.
|
|
|
|
optionsDoc = callPackage ./doc-support/options-doc.nix { };
|
|
|
|
|
2024-07-26 18:21:15 +00:00
|
|
|
pythonInterpreterTable = pkgs.callPackage ./doc-support/python-interpreter-table.nix {};
|
|
|
|
|
2018-12-30 00:10:19 +00:00
|
|
|
in pkgs.stdenv.mkDerivation {
|
2014-08-24 09:02:23 +00:00
|
|
|
name = "nixpkgs-manual";
|
|
|
|
|
2020-12-05 12:47:29 +00:00
|
|
|
nativeBuildInputs = with pkgs; [
|
2023-03-25 20:38:26 +00:00
|
|
|
nixos-render-docs
|
2020-12-05 12:47:29 +00:00
|
|
|
];
|
2014-08-24 09:02:23 +00:00
|
|
|
|
2024-06-14 18:33:43 +00:00
|
|
|
src = fs.toSource {
|
|
|
|
root = ./.;
|
|
|
|
fileset = fs.unions [
|
|
|
|
(fs.fileFilter (file:
|
|
|
|
file.hasExt "md"
|
|
|
|
|| file.hasExt "md.in"
|
|
|
|
) ./.)
|
|
|
|
./style.css
|
|
|
|
./anchor-use.js
|
|
|
|
./anchor.min.js
|
|
|
|
./manpage-urls.json
|
|
|
|
];
|
|
|
|
};
|
2018-03-24 15:36:10 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2023-06-22 23:03:02 +00:00
|
|
|
ln -s ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
|
2018-03-24 15:36:10 +00:00
|
|
|
'';
|
2014-08-24 09:02:23 +00:00
|
|
|
|
2024-06-14 18:22:38 +00:00
|
|
|
buildPhase = ''
|
2024-07-26 18:21:15 +00:00
|
|
|
substituteInPlace ./languages-frameworks/python.section.md \
|
|
|
|
--subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"
|
2024-05-23 08:36:15 +00:00
|
|
|
|
2023-03-25 20:38:26 +00:00
|
|
|
cat \
|
|
|
|
./functions/library.md.in \
|
2023-06-23 00:02:57 +00:00
|
|
|
${lib-docs}/index.md \
|
2023-03-25 20:38:26 +00:00
|
|
|
> ./functions/library.md
|
|
|
|
substitute ./manual.md.in ./manual.md \
|
2024-04-30 17:21:39 +00:00
|
|
|
--replace-fail '@MANUAL_VERSION@' '${pkgs.lib.version}'
|
2023-03-25 20:38:26 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-03-16 19:16:59 +00:00
|
|
|
cp -t out ./style.css ./anchor.min.js ./anchor-use.js
|
2023-03-25 20:38:26 +00:00
|
|
|
|
|
|
|
nixos-render-docs manual html \
|
|
|
|
--manpage-urls ./manpage-urls.json \
|
|
|
|
--revision ${pkgs.lib.trivial.revisionWithDefault (pkgs.rev or "master")} \
|
|
|
|
--stylesheet style.css \
|
|
|
|
--stylesheet highlightjs/mono-blue.css \
|
|
|
|
--script ./highlightjs/highlight.pack.js \
|
|
|
|
--script ./highlightjs/loader.js \
|
2024-03-16 19:16:59 +00:00
|
|
|
--script ./anchor.min.js \
|
|
|
|
--script ./anchor-use.js \
|
2023-03-25 20:38:26 +00:00
|
|
|
--toc-depth 1 \
|
|
|
|
--section-toc-depth 1 \
|
|
|
|
manual.md \
|
|
|
|
out/index.html
|
2023-04-25 12:37:50 +00:00
|
|
|
'';
|
|
|
|
|
2018-03-24 15:36:10 +00:00
|
|
|
installPhase = ''
|
2023-07-13 09:16:28 +00:00
|
|
|
dest="$out/${common.outputPath}"
|
2018-03-24 15:36:10 +00:00
|
|
|
mkdir -p "$(dirname "$dest")"
|
2023-03-25 20:38:26 +00:00
|
|
|
mv out "$dest"
|
2023-07-13 09:16:28 +00:00
|
|
|
mv "$dest/index.html" "$dest/${common.indexPath}"
|
2016-07-20 15:57:31 +00:00
|
|
|
|
2023-06-24 19:39:20 +00:00
|
|
|
cp ${epub} "$dest/nixpkgs-manual.epub"
|
2016-07-20 15:57:31 +00:00
|
|
|
|
2018-03-24 15:36:10 +00:00
|
|
|
mkdir -p $out/nix-support/
|
2023-07-13 09:16:28 +00:00
|
|
|
echo "doc manual $dest ${common.indexPath}" >> $out/nix-support/hydra-build-products
|
2018-06-06 20:36:17 +00:00
|
|
|
echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
|
2014-08-24 09:02:23 +00:00
|
|
|
'';
|
2023-12-18 18:37:16 +00:00
|
|
|
|
2024-07-26 18:21:15 +00:00
|
|
|
passthru = {
|
|
|
|
inherit pythonInterpreterTable;
|
2024-07-26 18:28:06 +00:00
|
|
|
tests.manpage-urls = callPackage ./tests/manpage-urls.nix { };
|
2024-07-26 18:21:15 +00:00
|
|
|
};
|
2014-08-24 09:02:23 +00:00
|
|
|
}
|