From a49d40a00523a9ba6714d91f157c0c764b674230 Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Medina Date: Thu, 13 Jul 2023 11:28:19 +0200 Subject: [PATCH] nixos manual: extract some build paths Co-authored-by: Shahar "Dawn" Or --- nixos/doc/manual/common.nix | 4 ++++ nixos/doc/manual/default.nix | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 nixos/doc/manual/common.nix diff --git a/nixos/doc/manual/common.nix b/nixos/doc/manual/common.nix new file mode 100644 index 000000000000..48d1d909492d --- /dev/null +++ b/nixos/doc/manual/common.nix @@ -0,0 +1,4 @@ +{ + outputPath = "share/doc/nixos"; + indexPath = "index.html"; +} diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index f2fd6a682934..902dee701801 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -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, @@ -78,11 +80,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 sed -e '/@PYTHON_MACHINE_METHODS@/ {' -e 'r ${testDriverMachineDocstrings}/machine-methods.md' -e 'd' -e '}' \ -i ./development/writing-nixos-tests.section.md ''; @@ -99,7 +101,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 @@ -120,7 +122,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 @@ -131,7 +133,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 ]; @@ -162,7 +164,7 @@ in rec { } '' # Generate the epub manual. - dst=$out/share/doc/nixos + dst=$out/${common.outputPath} xsltproc \ --param chapter.autolabel 0 \ @@ -197,7 +199,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 '';