about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAlejandro Sanchez Medina <alejandrosanchzmedina@gmail.com>2023-07-13 11:28:19 +0200
committerShahar "Dawn" Or <mightyiampresence@gmail.com>2023-07-25 17:03:12 +0700
commita49d40a00523a9ba6714d91f157c0c764b674230 (patch)
tree52e3b361bc330c407d0cb931424d40122cb511c3 /nixos
parent13aeddb926677e6becbc322a46c613a4899ceb4d (diff)
nixos manual: extract some build paths
Co-authored-by: Shahar "Dawn" Or <mightyiampresence@gmail.com>
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/common.nix4
-rw-r--r--nixos/doc/manual/default.nix16
2 files changed, 13 insertions, 7 deletions
diff --git a/nixos/doc/manual/common.nix b/nixos/doc/manual/common.nix
new file mode 100644
index 0000000000000..48d1d909492d6
--- /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 f2fd6a682934a..902dee7018010 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
     '';