2021-12-18 19:37:41 +01:00
|
|
|
|
{ pkgs
|
|
|
|
|
, options
|
|
|
|
|
, config
|
|
|
|
|
, version
|
|
|
|
|
, revision
|
|
|
|
|
, extraSources ? []
|
|
|
|
|
, baseOptionsJSON ? null
|
|
|
|
|
, warningsAreErrors ? true
|
2022-09-01 19:23:59 +02:00
|
|
|
|
, allowDocBook ? true
|
2021-12-18 19:37:41 +01:00
|
|
|
|
, prefix ? ../../..
|
|
|
|
|
}:
|
2008-06-05 17:33:17 +02:00
|
|
|
|
|
2014-08-09 16:30:44 +02:00
|
|
|
|
with pkgs;
|
2013-10-17 14:09:05 +02:00
|
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
|
let
|
2022-06-27 20:06:30 +02:00
|
|
|
|
inherit (lib) hasPrefix removePrefix;
|
|
|
|
|
|
2016-07-28 04:27:39 +02:00
|
|
|
|
lib = pkgs.lib;
|
2009-10-06 01:15:06 +02:00
|
|
|
|
|
2022-03-31 02:34:42 +02:00
|
|
|
|
docbook_xsl_ns = pkgs.docbook-xsl-ns.override {
|
|
|
|
|
withManOptDedupPatch = true;
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-31 04:19:28 +01:00
|
|
|
|
manpageUrls = pkgs.path + "/doc/manpage-urls.json";
|
|
|
|
|
|
2016-01-22 20:22:12 +01:00
|
|
|
|
# We need to strip references to /nix/store/* from options,
|
|
|
|
|
# including any `extraSources` if some modules came from elsewhere,
|
|
|
|
|
# or else the build will fail.
|
|
|
|
|
#
|
|
|
|
|
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
|
2016-01-29 16:20:22 +01:00
|
|
|
|
# you'd need to include `extraSources = [ pkgs.customModules ]`
|
2021-11-19 00:26:27 +01:00
|
|
|
|
prefixesToStrip = map (p: "${toString p}/") ([ prefix ] ++ extraSources);
|
2021-01-25 07:57:48 +01:00
|
|
|
|
stripAnyPrefixes = lib.flip (lib.foldr lib.removePrefix) prefixesToStrip;
|
2013-10-23 19:32:19 +02:00
|
|
|
|
|
2019-08-08 12:59:25 +02:00
|
|
|
|
optionsDoc = buildPackages.nixosOptionsDoc {
|
2022-09-01 19:23:59 +02:00
|
|
|
|
inherit options revision baseOptionsJSON warningsAreErrors allowDocBook;
|
2019-08-08 12:59:25 +02:00
|
|
|
|
transformOptions = opt: opt // {
|
|
|
|
|
# Clean up declaration sites to not refer to the NixOS source tree.
|
|
|
|
|
declarations = map stripAnyPrefixes opt.declarations;
|
|
|
|
|
};
|
|
|
|
|
};
|
2009-09-18 17:10:37 +02:00
|
|
|
|
|
2022-06-27 17:52:08 +02:00
|
|
|
|
nixos-lib = import ../../lib { };
|
|
|
|
|
|
|
|
|
|
testOptionsDoc = let
|
|
|
|
|
eval = nixos-lib.evalTest {
|
|
|
|
|
# Avoid evaluating a NixOS config prototype.
|
|
|
|
|
config.node.type = lib.types.deferredModule;
|
|
|
|
|
options._module.args = lib.mkOption { internal = true; };
|
|
|
|
|
};
|
|
|
|
|
in buildPackages.nixosOptionsDoc {
|
|
|
|
|
inherit (eval) options;
|
2022-12-18 23:22:17 +01:00
|
|
|
|
inherit revision;
|
2022-06-27 17:52:08 +02:00
|
|
|
|
transformOptions = opt: opt // {
|
|
|
|
|
# Clean up declaration sites to not refer to the NixOS source tree.
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
documentType = "none";
|
|
|
|
|
variablelistId = "test-options-list";
|
2022-09-29 12:41:59 +02:00
|
|
|
|
optionIdPrefix = "test-opt-";
|
2022-06-27 17:52:08 +02:00
|
|
|
|
};
|
|
|
|
|
|
2015-07-22 16:09:00 +02:00
|
|
|
|
toc = builtins.toFile "toc.xml"
|
|
|
|
|
''
|
|
|
|
|
<toc role="chunk-toc">
|
|
|
|
|
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-nixos-manual"><?dbhtml filename="index.html"?>
|
2015-07-22 16:17:06 +02:00
|
|
|
|
<d:tocentry linkend="ch-options"><?dbhtml filename="options.html"?></d:tocentry>
|
|
|
|
|
<d:tocentry linkend="ch-release-notes"><?dbhtml filename="release-notes.html"?></d:tocentry>
|
2015-07-22 16:09:00 +02:00
|
|
|
|
</d:tocentry>
|
|
|
|
|
</toc>
|
|
|
|
|
'';
|
|
|
|
|
|
nixos/doc: Allow refs from options to the manual
My first attempt to do this was to just use a conditional <refsection/>
in order to not create exact references in the manpage but create the
reference in the HTML manual, as suggested by @edolstra on IRC.
Later I went on to use <olink/> to reference sections of the manual, but
in order to do that, we need to overhaul how we generate the manual and
manpages.
So, that's where we are now:
There is a new derivation called "manual-olinkdb", which is the olinkdb
for the HTML manual, which in turn creates the olinkdb.xml file and the
manual.db. The former contains the targetdoc references and the latter
the specific targetptr elements.
The reason why I included the olinkdb.xml verbatim is that first of all
the DTD is dependent on the Docbook XSL sources and the references
within the olinkdb.xml entities are relative to the current directory.
So using a store path for that would end up searching for the manual.db
directly in /nix/store/manual.db.
Unfortunately, the <olinks/> that end up in the output file are
relative, so for example if you're clicking on one of these within the
PDF, the URL is searched in the current directory.
However, the sections from the olink's text are still valid, so we could
use an alternative URL for that in the future.
The manual doesn't contain any links, so even referencing the relative
URL shouldn't do any harm.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
2016-04-11 18:29:00 +02:00
|
|
|
|
manualXsltprocOptions = toString [
|
2022-12-12 13:04:39 +01:00
|
|
|
|
"--param chapter.autolabel 0"
|
|
|
|
|
"--param part.autolabel 0"
|
|
|
|
|
"--param preface.autolabel 0"
|
|
|
|
|
"--param reference.autolabel 0"
|
|
|
|
|
"--param section.autolabel 0"
|
2018-04-05 13:54:01 +02:00
|
|
|
|
"--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'"
|
|
|
|
|
"--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'"
|
2022-12-12 13:04:39 +01:00
|
|
|
|
"--param xref.with.number.and.title 0"
|
2019-10-28 11:46:10 +01:00
|
|
|
|
"--param toc.section.depth 0"
|
2020-10-31 21:18:16 +01:00
|
|
|
|
"--param generate.consistent.ids 1"
|
nixos/doc: Allow refs from options to the manual
My first attempt to do this was to just use a conditional <refsection/>
in order to not create exact references in the manpage but create the
reference in the HTML manual, as suggested by @edolstra on IRC.
Later I went on to use <olink/> to reference sections of the manual, but
in order to do that, we need to overhaul how we generate the manual and
manpages.
So, that's where we are now:
There is a new derivation called "manual-olinkdb", which is the olinkdb
for the HTML manual, which in turn creates the olinkdb.xml file and the
manual.db. The former contains the targetdoc references and the latter
the specific targetptr elements.
The reason why I included the olinkdb.xml verbatim is that first of all
the DTD is dependent on the Docbook XSL sources and the references
within the olinkdb.xml entities are relative to the current directory.
So using a store path for that would end up searching for the manual.db
directly in /nix/store/manual.db.
Unfortunately, the <olinks/> that end up in the output file are
relative, so for example if you're clicking on one of these within the
PDF, the URL is searched in the current directory.
However, the sections from the olink's text are still valid, so we could
use an alternative URL for that in the future.
The manual doesn't contain any links, so even referencing the relative
URL shouldn't do any harm.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
2016-04-11 18:29:00 +02:00
|
|
|
|
"--stringparam admon.style ''"
|
2018-04-05 13:54:01 +02:00
|
|
|
|
"--stringparam callout.graphics.extension .svg"
|
nixos/doc: Allow refs from options to the manual
My first attempt to do this was to just use a conditional <refsection/>
in order to not create exact references in the manpage but create the
reference in the HTML manual, as suggested by @edolstra on IRC.
Later I went on to use <olink/> to reference sections of the manual, but
in order to do that, we need to overhaul how we generate the manual and
manpages.
So, that's where we are now:
There is a new derivation called "manual-olinkdb", which is the olinkdb
for the HTML manual, which in turn creates the olinkdb.xml file and the
manual.db. The former contains the targetdoc references and the latter
the specific targetptr elements.
The reason why I included the olinkdb.xml verbatim is that first of all
the DTD is dependent on the Docbook XSL sources and the references
within the olinkdb.xml entities are relative to the current directory.
So using a store path for that would end up searching for the manual.db
directly in /nix/store/manual.db.
Unfortunately, the <olinks/> that end up in the output file are
relative, so for example if you're clicking on one of these within the
PDF, the URL is searched in the current directory.
However, the sections from the olink's text are still valid, so we could
use an alternative URL for that in the future.
The manual doesn't contain any links, so even referencing the relative
URL shouldn't do any harm.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
2016-04-11 18:29:00 +02:00
|
|
|
|
"--stringparam current.docid manual"
|
|
|
|
|
"--param chunk.section.depth 0"
|
|
|
|
|
"--param chunk.first.sections 1"
|
|
|
|
|
"--param use.id.as.filename 1"
|
|
|
|
|
"--stringparam chunk.toc ${toc}"
|
|
|
|
|
];
|
|
|
|
|
|
2023-02-12 09:04:07 +01:00
|
|
|
|
linterFunctions = ''
|
|
|
|
|
# outputs the context of an xmllint error output
|
|
|
|
|
# LEN lines around the failing line are printed
|
|
|
|
|
function context {
|
|
|
|
|
# length of context
|
|
|
|
|
local LEN=6
|
|
|
|
|
# lines to print before error line
|
|
|
|
|
local BEFORE=4
|
|
|
|
|
|
|
|
|
|
# xmllint output lines are:
|
|
|
|
|
# file.xml:1234: there was an error on line 1234
|
|
|
|
|
while IFS=':' read -r file line rest; do
|
|
|
|
|
echo
|
|
|
|
|
if [[ -n "$rest" ]]; then
|
|
|
|
|
echo "$file:$line:$rest"
|
|
|
|
|
local FROM=$(($line>$BEFORE ? $line - $BEFORE : 1))
|
|
|
|
|
# number lines & filter context
|
|
|
|
|
nl --body-numbering=a "$file" | sed -n "$FROM,+$LEN p"
|
|
|
|
|
else
|
|
|
|
|
if [[ -n "$line" ]]; then
|
|
|
|
|
echo "$file:$line"
|
|
|
|
|
else
|
|
|
|
|
echo "$file"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function lintrng {
|
|
|
|
|
xmllint --debug --noout --nonet \
|
|
|
|
|
--relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
|
|
|
|
|
"$1" \
|
|
|
|
|
2>&1 | context 1>&2
|
|
|
|
|
# ^ redirect assumes xmllint doesn’t print to stdout
|
|
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
|
2023-02-20 18:55:15 +01:00
|
|
|
|
prepareManualFromMD = ''
|
|
|
|
|
cp -r --no-preserve=all $inputs/* .
|
|
|
|
|
|
|
|
|
|
substituteInPlace ./manual.md \
|
|
|
|
|
--replace '@NIXOS_VERSION@' "${version}"
|
|
|
|
|
substituteInPlace ./configuration/configuration.md \
|
|
|
|
|
--replace \
|
|
|
|
|
'@MODULE_CHAPTERS@' \
|
|
|
|
|
${lib.escapeShellArg (lib.concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
|
|
|
|
|
substituteInPlace ./nixos-options.md \
|
|
|
|
|
--replace \
|
|
|
|
|
'@NIXOS_OPTIONS_JSON@' \
|
|
|
|
|
${optionsDoc.optionsJSON}/share/doc/nixos/options.json
|
|
|
|
|
substituteInPlace ./development/writing-nixos-tests.section.md \
|
|
|
|
|
--replace \
|
|
|
|
|
'@NIXOS_TEST_OPTIONS_JSON@' \
|
|
|
|
|
${testOptionsDoc.optionsJSON}/share/doc/nixos/options.json
|
|
|
|
|
'';
|
|
|
|
|
|
2017-06-28 19:02:33 +02:00
|
|
|
|
manual-combined = runCommand "nixos-manual-combined"
|
2023-02-12 09:40:07 +01:00
|
|
|
|
{ inputs = lib.sourceFilesBySuffices ./. [ ".xml" ".md" ];
|
|
|
|
|
nativeBuildInputs = [ pkgs.nixos-render-docs pkgs.libxml2.bin pkgs.libxslt.bin ];
|
2017-06-28 19:02:33 +02:00
|
|
|
|
meta.description = "The NixOS manual as plain docbook XML";
|
2016-09-27 15:26:37 +02:00
|
|
|
|
}
|
|
|
|
|
''
|
2023-02-20 18:55:15 +01:00
|
|
|
|
${prepareManualFromMD}
|
2023-02-11 08:48:06 +01:00
|
|
|
|
|
2023-02-13 13:43:32 +01:00
|
|
|
|
nixos-render-docs -j $NIX_BUILD_CORES manual docbook \
|
2023-02-12 09:40:07 +01:00
|
|
|
|
--manpage-urls ${manpageUrls} \
|
2023-02-11 08:48:06 +01:00
|
|
|
|
--revision ${lib.escapeShellArg revision} \
|
|
|
|
|
./manual.md \
|
2023-03-13 17:58:38 +01:00
|
|
|
|
./manual-combined-pre.xml
|
|
|
|
|
|
|
|
|
|
${pkgs.libxslt.bin}/bin/xsltproc \
|
|
|
|
|
-o manual-combined.xml ${./../../lib/make-options-doc/postprocess-option-descriptions.xsl} \
|
|
|
|
|
manual-combined-pre.xml
|
2017-11-19 00:44:17 +01:00
|
|
|
|
|
2023-02-12 09:04:07 +01:00
|
|
|
|
${linterFunctions}
|
2017-11-19 00:44:17 +01:00
|
|
|
|
|
2017-06-28 19:02:33 +02:00
|
|
|
|
mkdir $out
|
|
|
|
|
cp manual-combined.xml $out/
|
2022-06-27 17:18:02 +02:00
|
|
|
|
|
|
|
|
|
lintrng $out/manual-combined.xml
|
2023-02-12 09:04:07 +01:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
manpages-combined = runCommand "nixos-manpages-combined.xml"
|
|
|
|
|
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
|
|
|
|
|
meta.description = "The NixOS manpages as plain docbook XML";
|
|
|
|
|
}
|
|
|
|
|
''
|
|
|
|
|
mkdir generated
|
|
|
|
|
cp -prd ${./man-pages.xml} man-pages.xml
|
|
|
|
|
ln -s ${optionsDoc.optionsDocBook} generated/options-db.xml
|
|
|
|
|
|
|
|
|
|
xmllint --xinclude --noxincludenode --output $out ./man-pages.xml
|
|
|
|
|
|
|
|
|
|
${linterFunctions}
|
|
|
|
|
|
|
|
|
|
lintrng $out
|
2017-06-28 19:02:33 +02:00
|
|
|
|
'';
|
|
|
|
|
|
2010-08-11 14:28:53 +02:00
|
|
|
|
in rec {
|
2023-01-15 14:56:46 +01:00
|
|
|
|
inherit (optionsDoc) optionsJSON optionsNix optionsDocBook optionsUsedDocbook;
|
2014-11-17 13:41:18 +01:00
|
|
|
|
|
2010-08-11 14:28:53 +02:00
|
|
|
|
# Generate the NixOS manual.
|
2018-09-06 21:17:44 +02:00
|
|
|
|
manualHTML = runCommand "nixos-manual-html"
|
2023-02-20 18:55:15 +01:00
|
|
|
|
{ nativeBuildInputs =
|
|
|
|
|
if allowDocBook then [
|
|
|
|
|
buildPackages.libxml2.bin
|
|
|
|
|
buildPackages.libxslt.bin
|
|
|
|
|
] else [
|
|
|
|
|
buildPackages.nixos-render-docs
|
|
|
|
|
];
|
|
|
|
|
inputs = lib.optionals (! allowDocBook) (lib.sourceFilesBySuffices ./. [ ".md" ]);
|
2016-09-27 15:26:37 +02:00
|
|
|
|
meta.description = "The NixOS manual in HTML format";
|
|
|
|
|
allowedReferences = ["out"];
|
|
|
|
|
}
|
|
|
|
|
''
|
2009-10-05 15:17:45 +02:00
|
|
|
|
# Generate the HTML manual.
|
2009-07-14 17:47:03 +02:00
|
|
|
|
dst=$out/share/doc/nixos
|
2014-06-30 14:56:10 +02:00
|
|
|
|
mkdir -p $dst
|
2013-01-09 13:43:57 +01:00
|
|
|
|
|
2018-04-05 13:54:01 +02:00
|
|
|
|
cp ${../../../doc/style.css} $dst/style.css
|
|
|
|
|
cp ${../../../doc/overrides.css} $dst/overrides.css
|
|
|
|
|
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
2023-02-20 18:55:15 +01:00
|
|
|
|
${if allowDocBook then ''
|
|
|
|
|
xsltproc \
|
|
|
|
|
${manualXsltprocOptions} \
|
|
|
|
|
--stringparam id.warnings "1" \
|
|
|
|
|
--nonet --output $dst/ \
|
|
|
|
|
${docbook_xsl_ns}/xml/xsl/docbook/xhtml/chunktoc.xsl \
|
|
|
|
|
${manual-combined}/manual-combined.xml \
|
|
|
|
|
|& tee xsltproc.out
|
|
|
|
|
grep "^ID recommended on" xsltproc.out &>/dev/null && echo "error: some IDs are missing" && false
|
|
|
|
|
rm xsltproc.out
|
|
|
|
|
|
|
|
|
|
mkdir -p $dst/images/callouts
|
|
|
|
|
cp ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
|
|
|
|
|
'' else ''
|
|
|
|
|
${prepareManualFromMD}
|
|
|
|
|
|
|
|
|
|
# TODO generator is set like this because the docbook/md manual compare workflow will
|
|
|
|
|
# trigger if it's different
|
|
|
|
|
nixos-render-docs -j $NIX_BUILD_CORES manual html \
|
|
|
|
|
--manpage-urls ${manpageUrls} \
|
|
|
|
|
--revision ${lib.escapeShellArg revision} \
|
|
|
|
|
--generator "DocBook XSL Stylesheets V${docbook_xsl_ns.version}" \
|
|
|
|
|
--stylesheet style.css \
|
|
|
|
|
--stylesheet overrides.css \
|
|
|
|
|
--stylesheet highlightjs/mono-blue.css \
|
|
|
|
|
--script ./highlightjs/highlight.pack.js \
|
|
|
|
|
--script ./highlightjs/loader.js \
|
|
|
|
|
--toc-depth 1 \
|
|
|
|
|
--chunk-toc-depth 1 \
|
|
|
|
|
./manual.md \
|
|
|
|
|
$dst/index.html
|
|
|
|
|
''}
|
|
|
|
|
|
2013-10-24 20:06:02 +02:00
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
|
2014-09-10 15:03:49 +02:00
|
|
|
|
echo "doc manual $dst" >> $out/nix-support/hydra-build-products
|
2012-07-25 17:54:24 +02:00
|
|
|
|
''; # */
|
2013-10-24 20:06:02 +02:00
|
|
|
|
|
2018-09-06 21:17:44 +02:00
|
|
|
|
# Alias for backward compatibility. TODO(@oxij): remove eventually.
|
|
|
|
|
manual = manualHTML;
|
|
|
|
|
|
|
|
|
|
# Index page of the NixOS manual.
|
|
|
|
|
manualHTMLIndex = "${manualHTML}/share/doc/nixos/index.html";
|
2010-08-11 14:28:53 +02:00
|
|
|
|
|
2016-09-27 15:26:37 +02:00
|
|
|
|
manualEpub = runCommand "nixos-manual-epub"
|
2023-02-12 09:40:07 +01:00
|
|
|
|
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin buildPackages.zip ];
|
2016-09-27 15:26:37 +02:00
|
|
|
|
}
|
|
|
|
|
''
|
2016-07-28 04:27:39 +02:00
|
|
|
|
# Generate the epub manual.
|
|
|
|
|
dst=$out/share/doc/nixos
|
|
|
|
|
|
|
|
|
|
xsltproc \
|
|
|
|
|
${manualXsltprocOptions} \
|
|
|
|
|
--nonet --xinclude --output $dst/epub/ \
|
2018-07-17 22:11:16 +02:00
|
|
|
|
${docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl \
|
2017-06-28 19:02:33 +02:00
|
|
|
|
${manual-combined}/manual-combined.xml
|
2016-07-28 04:27:39 +02:00
|
|
|
|
|
|
|
|
|
mkdir -p $dst/epub/OEBPS/images/callouts
|
2018-07-17 22:11:16 +02:00
|
|
|
|
cp -r ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts/*.svg $dst/epub/OEBPS/images/callouts # */
|
2016-07-28 04:27:39 +02:00
|
|
|
|
echo "application/epub+zip" > mimetype
|
2016-08-01 11:02:41 +02:00
|
|
|
|
manual="$dst/nixos-manual.epub"
|
|
|
|
|
zip -0Xq "$manual" mimetype
|
|
|
|
|
cd $dst/epub && zip -Xr9D "$manual" *
|
|
|
|
|
|
|
|
|
|
rm -rf $dst/epub
|
2016-07-28 04:27:39 +02:00
|
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
2016-08-01 11:02:41 +02:00
|
|
|
|
echo "doc-epub manual $manual" >> $out/nix-support/hydra-build-products
|
2016-07-28 04:27:39 +02:00
|
|
|
|
'';
|
|
|
|
|
|
2010-08-11 14:28:53 +02:00
|
|
|
|
|
2016-09-27 15:26:37 +02:00
|
|
|
|
# Generate the NixOS manpages.
|
|
|
|
|
manpages = runCommand "nixos-manpages"
|
2023-02-07 14:17:43 +01:00
|
|
|
|
{ nativeBuildInputs = [
|
2023-01-31 04:19:28 +01:00
|
|
|
|
buildPackages.installShellFiles
|
|
|
|
|
] ++ lib.optionals allowDocBook [
|
2023-01-29 01:07:26 +01:00
|
|
|
|
buildPackages.libxml2.bin
|
|
|
|
|
buildPackages.libxslt.bin
|
2023-01-31 04:19:28 +01:00
|
|
|
|
] ++ lib.optionals (! allowDocBook) [
|
|
|
|
|
buildPackages.nixos-render-docs
|
2023-01-29 01:07:26 +01:00
|
|
|
|
];
|
2016-09-27 15:26:37 +02:00
|
|
|
|
allowedReferences = ["out"];
|
|
|
|
|
}
|
|
|
|
|
''
|
2009-10-05 15:17:45 +02:00
|
|
|
|
# Generate manpages.
|
2023-01-29 01:07:26 +01:00
|
|
|
|
mkdir -p $out/share/man/man8
|
|
|
|
|
installManPage ${./manpages}/*
|
2023-01-31 04:19:28 +01:00
|
|
|
|
${if allowDocBook
|
|
|
|
|
then ''
|
|
|
|
|
xsltproc --nonet \
|
|
|
|
|
--maxdepth 6000 \
|
|
|
|
|
--param man.output.in.separate.dir 1 \
|
|
|
|
|
--param man.output.base.dir "'$out/share/man/'" \
|
|
|
|
|
--param man.endnotes.are.numbered 0 \
|
|
|
|
|
--param man.break.after.slash 1 \
|
|
|
|
|
${docbook_xsl_ns}/xml/xsl/docbook/manpages/docbook.xsl \
|
2023-02-12 09:04:07 +01:00
|
|
|
|
${manpages-combined}
|
2023-01-31 04:19:28 +01:00
|
|
|
|
''
|
|
|
|
|
else ''
|
|
|
|
|
mkdir -p $out/share/man/man5
|
2023-02-13 13:43:32 +01:00
|
|
|
|
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
2023-01-31 04:19:28 +01:00
|
|
|
|
--revision ${lib.escapeShellArg revision} \
|
|
|
|
|
${optionsJSON}/share/doc/nixos/options.json \
|
|
|
|
|
$out/share/man/man5/configuration.nix.5
|
|
|
|
|
''}
|
2008-01-04 15:24:42 +01:00
|
|
|
|
'';
|
2015-09-24 11:47:00 +02:00
|
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
|
}
|