about summary refs log tree commit diff
path: root/nixos/doc
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2023-07-27 16:11:18 +0200
committerGitHub <noreply@github.com>2023-07-27 16:11:18 +0200
commita7e58002736927cf50f8348363176b594f3976af (patch)
treead147402553254a2fc8355d31fd24a7f70fd42de /nixos/doc
parent7e525c3508e4bd0f38915e0345147672436b3aa5 (diff)
parenta064709342b6adfcafe5bdcff3b5ace453359761 (diff)
downloadnixlib-a7e58002736927cf50f8348363176b594f3976af.tar
nixlib-a7e58002736927cf50f8348363176b594f3976af.tar.gz
nixlib-a7e58002736927cf50f8348363176b594f3976af.tar.bz2
nixlib-a7e58002736927cf50f8348363176b594f3976af.tar.lz
nixlib-a7e58002736927cf50f8348363176b594f3976af.tar.xz
nixlib-a7e58002736927cf50f8348363176b594f3976af.tar.zst
nixlib-a7e58002736927cf50f8348363176b594f3976af.zip
Merge pull request #243062 from mobusoperandi/doc_watchexec
nixpkgs/NixOS manuals: devmode feature
Diffstat (limited to 'nixos/doc')
-rw-r--r--nixos/doc/manual/common.nix4
-rw-r--r--nixos/doc/manual/contributing-to-this-manual.chapter.md2
-rw-r--r--nixos/doc/manual/default.nix16
-rw-r--r--nixos/doc/manual/shell.nix20
4 files changed, 35 insertions, 7 deletions
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/contributing-to-this-manual.chapter.md b/nixos/doc/manual/contributing-to-this-manual.chapter.md
index c306cc084cdb..4633c7e1b058 100644
--- a/nixos/doc/manual/contributing-to-this-manual.chapter.md
+++ b/nixos/doc/manual/contributing-to-this-manual.chapter.md
@@ -11,6 +11,8 @@ $ nix-build nixos/release.nix -A manual.x86_64-linux
 
 If the build succeeds, the manual will be in `./result/share/doc/nixos/index.html`.
 
+There's also [a convenient development daemon](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-devmode).
+
 **Contributing to the man pages**
 
 The man pages are written in [DocBook] which is XML.
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
     '';
 
diff --git a/nixos/doc/manual/shell.nix b/nixos/doc/manual/shell.nix
new file mode 100644
index 000000000000..70500a12b037
--- /dev/null
+++ b/nixos/doc/manual/shell.nix
@@ -0,0 +1,20 @@
+let
+  pkgs = import ../../.. {
+    config = {};
+    overlays = [];
+  };
+
+  common = import ./common.nix;
+  inherit (common) outputPath indexPath;
+
+  web-devmode = import ../../../pkgs/tools/nix/web-devmode.nix {
+    inherit pkgs;
+    buildArgs = "../../release.nix -A manualHTML.${builtins.currentSystem}";
+    open = "/${outputPath}/${indexPath}";
+  };
+in
+  pkgs.mkShell {
+    packages = [
+      web-devmode
+    ];
+  }