Skip to content

Commit

Permalink
nixos manual: extract some build paths
Browse files Browse the repository at this point in the history
Co-authored-by: Shahar "Dawn" Or <mightyiampresence@gmail.com>
  • Loading branch information
alejandrosame and mightyiam committed Jul 13, 2023
1 parent 3b7ff4f commit 8169eb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions nixos/doc/manual/common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
outputPath = "share/doc/nixos";
indexPath = "index.html";
}
16 changes: 9 additions & 7 deletions nixos/doc/manual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ let

lib = pkgs.lib;

common = import ./common.nix;

manpageUrls = pkgs.path + "/doc/manpage-urls.json";

# We need to strip references to /nix/store/* from options,
Expand Down Expand Up @@ -75,11 +77,11 @@ let
substituteInPlace ./nixos-options.md \
--replace \
'@NIXOS_OPTIONS_JSON@' \
${optionsDoc.optionsJSON}/share/doc/nixos/options.json
${optionsDoc.optionsJSON}/${common.outputPath}/options.json
substituteInPlace ./development/writing-nixos-tests.section.md \
--replace \
'@NIXOS_TEST_OPTIONS_JSON@' \
${testOptionsDoc.optionsJSON}/share/doc/nixos/options.json
${testOptionsDoc.optionsJSON}/${common.outputPath}/options.json
'';

in rec {
Expand All @@ -94,7 +96,7 @@ in rec {
}
''
# Generate the HTML manual.
dst=$out/share/doc/nixos
dst=$out/${common.outputPath}
mkdir -p $dst
cp ${../../../doc/style.css} $dst/style.css
Expand All @@ -115,7 +117,7 @@ in rec {
--toc-depth 1 \
--chunk-toc-depth 1 \
./manual.md \
$dst/index.html
$dst/${common.indexPath}
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
Expand All @@ -126,7 +128,7 @@ in rec {
manual = manualHTML;

# Index page of the NixOS manual.
manualHTMLIndex = "${manualHTML}/share/doc/nixos/index.html";
manualHTMLIndex = "${manualHTML}/${common.outputPath}/${common.indexPath}";

manualEpub = runCommand "nixos-manual-epub"
{ nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin buildPackages.zip ];
Expand Down Expand Up @@ -157,7 +159,7 @@ in rec {
}
''
# Generate the epub manual.
dst=$out/share/doc/nixos
dst=$out/${common.outputPath}
xsltproc \
--param chapter.autolabel 0 \
Expand Down Expand Up @@ -192,7 +194,7 @@ in rec {
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 \
${optionsJSON}/${common.outputPath}/options.json \
$out/share/man/man5/configuration.nix.5
'';

Expand Down

0 comments on commit 8169eb4

Please sign in to comment.