about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2022-10-04 21:35:49 +0100
committerGitHub <noreply@github.com>2022-10-04 21:35:49 +0100
commit70ec3b9f545e9c681e5dfcac10fcde3c4ff1eb87 (patch)
tree008711d472cd6362e7faf49feb48f30edc6ebfc4 /nixos/lib
parent603bdef4c7b21a5ae9f23f63950e95c177ff18b5 (diff)
parent216c5dc10dd9d842909fe256567e9aeda3212396 (diff)
Merge pull request #193498 from hercules-ci/nixos-doc-disambiguate-test-options
nixos/doc: disambiguate test option ids
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/make-options-doc/default.nix3
-rw-r--r--nixos/lib/make-options-doc/options-to-docbook.xsl3
-rw-r--r--nixos/lib/testing/driver.nix6
-rw-r--r--nixos/lib/testing/meta.nix4
-rw-r--r--nixos/lib/testing/name.nix2
-rw-r--r--nixos/lib/testing/nodes.nix8
6 files changed, 15 insertions, 11 deletions
diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix
index 43dbff0e68ddb..6a1bb868c20de 100644
--- a/nixos/lib/make-options-doc/default.nix
+++ b/nixos/lib/make-options-doc/default.nix
@@ -26,6 +26,8 @@
   # If you include more than one option list into a document, you need to
   # provide different ids.
 , variablelistId ? "configuration-variable-list"
+  # Strig to prefix to the option XML/HTML id attributes.
+, optionIdPrefix ? "opt-"
 , revision ? "" # Specify revision for the options
 # a set of options the docs we are generating will be merged into, as if by recursiveUpdate.
 # used to split the options doc build into a static part (nixos/modules) and a dynamic part
@@ -183,6 +185,7 @@ in rec {
       --stringparam documentType '${documentType}' \
       --stringparam revision '${revision}' \
       --stringparam variablelistId '${variablelistId}' \
+      --stringparam optionIdPrefix '${optionIdPrefix}' \
       -o intermediate.xml ${./options-to-docbook.xsl} sorted.xml
     ${pkgs.libxslt.bin}/bin/xsltproc \
       -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml
diff --git a/nixos/lib/make-options-doc/options-to-docbook.xsl b/nixos/lib/make-options-doc/options-to-docbook.xsl
index 978d5e2468a83..d5b921b1dedb3 100644
--- a/nixos/lib/make-options-doc/options-to-docbook.xsl
+++ b/nixos/lib/make-options-doc/options-to-docbook.xsl
@@ -15,6 +15,7 @@
   <xsl:param name="documentType" />
   <xsl:param name="program" />
   <xsl:param name="variablelistId" />
+  <xsl:param name="optionIdPrefix" />
 
 
   <xsl:template match="/expr/list">
@@ -36,7 +37,7 @@
       <xsl:attribute name="id" namespace="http://www.w3.org/XML/1998/namespace"><xsl:value-of select="$variablelistId"/></xsl:attribute>
         <xsl:for-each select="attrs">
           <xsl:variable name="id" select="
-            concat('opt-',
+            concat($optionIdPrefix,
               translate(
                 attr[@name = 'name']/string/@value,
                 '*&lt; >[]:',
diff --git a/nixos/lib/testing/driver.nix b/nixos/lib/testing/driver.nix
index 04e99f9e21d61..fb181c1d7e9ad 100644
--- a/nixos/lib/testing/driver.nix
+++ b/nixos/lib/testing/driver.nix
@@ -120,7 +120,7 @@ in
     };
 
     qemu.package = mkOption {
-      description = mdDoc "Which qemu package to use for the virtualisation of [{option}`nodes`](#opt-nodes).";
+      description = mdDoc "Which qemu package to use for the virtualisation of [{option}`nodes`](#test-opt-nodes).";
       type = types.package;
       default = hostPkgs.qemu_test;
       defaultText = "hostPkgs.qemu_test";
@@ -152,7 +152,7 @@ in
       description = mdDoc ''
         Extra arguments to pass to the test driver.
 
-        They become part of [{option}`driver`](#opt-driver) via `wrapProgram`.
+        They become part of [{option}`driver`](#test-opt-driver) via `wrapProgram`.
       '';
       type = types.listOf types.str;
       default = [];
@@ -172,7 +172,7 @@ in
       description = mdDoc ''
         Disable type checking. This must not be enabled for new NixOS tests.
 
-        This may speed up your iteration cycle, unless you're working on the [{option}`testScript`](#opt-testScript).
+        This may speed up your iteration cycle, unless you're working on the [{option}`testScript`](#test-opt-testScript).
       '';
     };
   };
diff --git a/nixos/lib/testing/meta.nix b/nixos/lib/testing/meta.nix
index 4d8b0e0f1c439..65754fe3c5419 100644
--- a/nixos/lib/testing/meta.nix
+++ b/nixos/lib/testing/meta.nix
@@ -24,14 +24,14 @@ in
             type = types.nullOr types.int;
             default = null; # NOTE: null values are filtered out by `meta`.
             description = mdDoc ''
-              The [{option}`test`](#opt-test)'s [`meta.timeout`](https://nixos.org/manual/nixpkgs/stable/#var-meta-timeout) in seconds.
+              The [{option}`test`](#test-opt-test)'s [`meta.timeout`](https://nixos.org/manual/nixpkgs/stable/#var-meta-timeout) in seconds.
             '';
           };
           broken = lib.mkOption {
             type = types.bool;
             default = false;
             description = mdDoc ''
-              Sets the [`meta.broken`](https://nixos.org/manual/nixpkgs/stable/#var-meta-broken) attribute on the [{option}`test`](#opt-test) derivation.
+              Sets the [`meta.broken`](https://nixos.org/manual/nixpkgs/stable/#var-meta-broken) attribute on the [{option}`test`](#test-opt-test) derivation.
             '';
           };
         };
diff --git a/nixos/lib/testing/name.nix b/nixos/lib/testing/name.nix
index a54622e139bf6..0af593169eeca 100644
--- a/nixos/lib/testing/name.nix
+++ b/nixos/lib/testing/name.nix
@@ -7,7 +7,7 @@ in
     description = mdDoc ''
       The name of the test.
 
-      This is used in the derivation names of the [{option}`driver`](#opt-driver) and [{option}`test`](#opt-test) runner.
+      This is used in the derivation names of the [{option}`driver`](#test-opt-driver) and [{option}`test`](#test-opt-test) runner.
     '';
     type = types.str;
   };
diff --git a/nixos/lib/testing/nodes.nix b/nixos/lib/testing/nodes.nix
index 765af2878dfe8..0395238cbaae7 100644
--- a/nixos/lib/testing/nodes.nix
+++ b/nixos/lib/testing/nodes.nix
@@ -44,7 +44,7 @@ in
       description = mdDoc ''
         An attribute set of NixOS configuration modules.
 
-        The configurations are augmented by the [`defaults`](#opt-defaults) option.
+        The configurations are augmented by the [`defaults`](#test-opt-defaults) option.
 
         They are assigned network addresses according to the `nixos/lib/testing/network.nix` module.
 
@@ -54,7 +54,7 @@ in
 
     defaults = mkOption {
       description = mdDoc ''
-        NixOS configuration that is applied to all [{option}`nodes`](#opt-nodes).
+        NixOS configuration that is applied to all [{option}`nodes`](#test-opt-nodes).
       '';
       type = types.deferredModule;
       default = { };
@@ -62,7 +62,7 @@ in
 
     extraBaseModules = mkOption {
       description = mdDoc ''
-        NixOS configuration that, like [{option}`defaults`](#opt-defaults), is applied to all [{option}`nodes`](#opt-nodes) and can not be undone with [`specialisation.<name>.inheritParentConfig`](https://search.nixos.org/options?show=specialisation.%3Cname%3E.inheritParentConfig&from=0&size=50&sort=relevance&type=packages&query=specialisation).
+        NixOS configuration that, like [{option}`defaults`](#test-opt-defaults), is applied to all [{option}`nodes`](#test-opt-nodes) and can not be undone with [`specialisation.<name>.inheritParentConfig`](https://search.nixos.org/options?show=specialisation.%3Cname%3E.inheritParentConfig&from=0&size=50&sort=relevance&type=packages&query=specialisation).
       '';
       type = types.deferredModule;
       default = { };
@@ -82,7 +82,7 @@ in
       type = types.bool;
       default = false;
       description = mdDoc ''
-        Enable to configure all [{option}`nodes`](#opt-nodes) to run with a minimal kernel.
+        Enable to configure all [{option}`nodes`](#test-opt-nodes) to run with a minimal kernel.
       '';
     };