2019-07-04 12:23:39 +00:00
|
|
|
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
|
|
|
|
let
|
2022-06-14 22:44:09 +00:00
|
|
|
inherit (pkgs) lib;
|
|
|
|
inherit (lib) hasPrefix removePrefix;
|
|
|
|
|
2022-12-12 11:21:59 +00:00
|
|
|
libsets = [
|
|
|
|
{ name = "asserts"; description = "Assert functions"; }
|
|
|
|
{ name = "attrsets"; description = "Attribute-set functions"; }
|
|
|
|
{ name = "strings"; description = "String manipulation functions"; }
|
|
|
|
{ name = "versions"; description = "Version string functions"; }
|
|
|
|
{ name = "trivial"; description = "Miscellaneous functions"; }
|
|
|
|
{ name = "lists"; description = "List manipulation functions"; }
|
|
|
|
{ name = "debug"; description = "Debugging functions"; }
|
|
|
|
{ name = "options"; description = "NixOS / nixpkgs option handling"; }
|
|
|
|
{ name = "filesystem"; description = "Filesystem functions"; }
|
|
|
|
{ name = "sources"; description = "Source filtering functions"; }
|
|
|
|
{ name = "cli"; description = "Command-line serialization functions"; }
|
|
|
|
];
|
2022-12-11 14:56:09 +00:00
|
|
|
|
|
|
|
locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs libsets; };
|
|
|
|
functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs libsets; };
|
2019-07-04 12:27:16 +00:00
|
|
|
version = pkgs.lib.version;
|
2019-07-04 13:06:39 +00:00
|
|
|
|
|
|
|
epub-xsl = pkgs.writeText "epub.xsl" ''
|
|
|
|
<?xml version='1.0'?>
|
|
|
|
<xsl:stylesheet
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
version="1.0">
|
|
|
|
<xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl" />
|
|
|
|
<xsl:import href="${./parameters.xml}"/>
|
|
|
|
</xsl:stylesheet>
|
|
|
|
'';
|
|
|
|
|
|
|
|
xhtml-xsl = pkgs.writeText "xhtml.xsl" ''
|
|
|
|
<?xml version='1.0'?>
|
|
|
|
<xsl:stylesheet
|
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
version="1.0">
|
|
|
|
<xsl:import href="${pkgs.docbook_xsl_ns}/xml/xsl/docbook/xhtml/docbook.xsl" />
|
|
|
|
<xsl:import href="${./parameters.xml}"/>
|
|
|
|
</xsl:stylesheet>
|
|
|
|
'';
|
2022-05-01 19:43:10 +00:00
|
|
|
|
|
|
|
# NB: This file describes the Nixpkgs manual, which happens to use module
|
|
|
|
# docs infra originally developed for NixOS.
|
|
|
|
optionsDoc = pkgs.nixosOptionsDoc {
|
|
|
|
inherit (pkgs.lib.evalModules { modules = [ ../../pkgs/top-level/config.nix ]; }) options;
|
|
|
|
documentType = "none";
|
2022-06-14 22:44:09 +00:00
|
|
|
transformOptions = opt:
|
|
|
|
opt // {
|
|
|
|
declarations =
|
|
|
|
map
|
|
|
|
(decl:
|
|
|
|
if hasPrefix (toString ../..) (toString decl)
|
|
|
|
then
|
|
|
|
let subpath = removePrefix "/" (removePrefix (toString ../..) (toString decl));
|
|
|
|
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
|
|
|
|
else decl)
|
|
|
|
opt.declarations;
|
|
|
|
};
|
2022-05-01 19:43:10 +00:00
|
|
|
};
|
|
|
|
|
2019-07-04 12:23:39 +00:00
|
|
|
in pkgs.runCommand "doc-support" {}
|
|
|
|
''
|
|
|
|
mkdir result
|
|
|
|
(
|
|
|
|
cd result
|
|
|
|
ln -s ${locationsXml} ./function-locations.xml
|
|
|
|
ln -s ${functionDocs} ./function-docs
|
2022-05-01 19:43:10 +00:00
|
|
|
ln -s ${optionsDoc.optionsDocBook} ./config-options.docbook.xml
|
2019-07-04 12:30:13 +00:00
|
|
|
|
|
|
|
ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng
|
2019-07-04 12:46:47 +00:00
|
|
|
ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl
|
2019-07-04 13:06:39 +00:00
|
|
|
ln -s ${epub-xsl} ./epub.xsl
|
|
|
|
ln -s ${xhtml-xsl} ./xhtml.xsl
|
2019-07-04 12:30:13 +00:00
|
|
|
|
2019-07-04 12:51:43 +00:00
|
|
|
ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf
|
2019-07-04 12:46:59 +00:00
|
|
|
ln -s ${pkgs.documentation-highlighter} ./highlightjs
|
|
|
|
|
2019-07-04 12:27:16 +00:00
|
|
|
echo -n "${version}" > ./version
|
2019-07-04 12:23:39 +00:00
|
|
|
)
|
|
|
|
mv result $out
|
|
|
|
''
|