nixos manual: extract some build paths

Co-authored-by: Shahar "Dawn" Or <mightyiampresence@gmail.com>

Changed files
+13 -7
nixos
doc
+4
nixos/doc/manual/common.nix
···
···
+
{
+
outputPath = "share/doc/nixos";
+
indexPath = "index.html";
+
}
+9 -7
nixos/doc/manual/default.nix
···
lib = pkgs.lib;
manpageUrls = pkgs.path + "/doc/manpage-urls.json";
# We need to strip references to /nix/store/* from options,
···
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
sed -e '/@PYTHON_MACHINE_METHODS@/ {' -e 'r ${testDriverMachineDocstrings}/machine-methods.md' -e 'd' -e '}' \
-i ./development/writing-nixos-tests.section.md
'';
···
}
''
# Generate the HTML manual.
-
dst=$out/share/doc/nixos
mkdir -p $dst
cp ${../../../doc/style.css} $dst/style.css
···
--toc-depth 1 \
--chunk-toc-depth 1 \
./manual.md \
-
$dst/index.html
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
···
manual = manualHTML;
# Index page of the NixOS manual.
-
manualHTMLIndex = "${manualHTML}/share/doc/nixos/index.html";
manualEpub = runCommand "nixos-manual-epub"
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin buildPackages.zip ];
···
}
''
# Generate the epub manual.
-
dst=$out/share/doc/nixos
xsltproc \
--param chapter.autolabel 0 \
···
mkdir -p $out/share/man/man5
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${lib.escapeShellArg revision} \
-
${optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/configuration.nix.5
'';
···
lib = pkgs.lib;
+
common = import ./common.nix;
+
manpageUrls = pkgs.path + "/doc/manpage-urls.json";
# We need to strip references to /nix/store/* from options,
···
substituteInPlace ./nixos-options.md \
--replace \
'@NIXOS_OPTIONS_JSON@' \
+
${optionsDoc.optionsJSON}/${common.outputPath}/options.json
substituteInPlace ./development/writing-nixos-tests.section.md \
--replace \
'@NIXOS_TEST_OPTIONS_JSON@' \
+
${testOptionsDoc.optionsJSON}/${common.outputPath}/options.json
sed -e '/@PYTHON_MACHINE_METHODS@/ {' -e 'r ${testDriverMachineDocstrings}/machine-methods.md' -e 'd' -e '}' \
-i ./development/writing-nixos-tests.section.md
'';
···
}
''
# Generate the HTML manual.
+
dst=$out/${common.outputPath}
mkdir -p $dst
cp ${../../../doc/style.css} $dst/style.css
···
--toc-depth 1 \
--chunk-toc-depth 1 \
./manual.md \
+
$dst/${common.indexPath}
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
···
manual = manualHTML;
# Index page of the NixOS manual.
+
manualHTMLIndex = "${manualHTML}/${common.outputPath}/${common.indexPath}";
manualEpub = runCommand "nixos-manual-epub"
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin buildPackages.zip ];
···
}
''
# Generate the epub manual.
+
dst=$out/${common.outputPath}
xsltproc \
--param chapter.autolabel 0 \
···
mkdir -p $out/share/man/man5
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${lib.escapeShellArg revision} \
+
${optionsJSON}/${common.outputPath}/options.json \
$out/share/man/man5/configuration.nix.5
'';