1 { pkgs ? (import ../.. {}), nixpkgs ? { }}:
4 inherit (lib) hasPrefix removePrefix;
6 locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; };
7 functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; };
8 version = pkgs.lib.version;
10 epub-xsl = pkgs.writeText "epub.xsl" ''
13 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 <xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl" />
16 <xsl:import href="${./parameters.xml}"/>
20 xhtml-xsl = pkgs.writeText "xhtml.xsl" ''
23 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
25 <xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/xhtml/docbook.xsl" />
26 <xsl:import href="${./parameters.xml}"/>
30 # NB: This file describes the Nixpkgs manual, which happens to use module
31 # docs infra originally developed for NixOS.
32 optionsDoc = pkgs.nixosOptionsDoc {
33 inherit (pkgs.lib.evalModules { modules = [ ../../pkgs/top-level/config.nix ]; }) options;
34 documentType = "none";
35 transformOptions = opt:
40 if hasPrefix (toString ../..) (toString decl)
42 let subpath = removePrefix "/" (removePrefix (toString ../..) (toString decl));
43 in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
49 in pkgs.runCommand "doc-support" {}
54 ln -s ${locationsXml} ./function-locations.xml
55 ln -s ${functionDocs} ./function-docs
56 ln -s ${optionsDoc.optionsDocBook} ./config-options.docbook.xml
58 ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng
59 ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl
60 ln -s ${epub-xsl} ./epub.xsl
61 ln -s ${xhtml-xsl} ./xhtml.xsl
63 ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf
64 ln -s ${pkgs.documentation-highlighter} ./highlightjs
66 echo -n "${version}" > ./version