summary refs log tree commit diff
path: root/nixos/lib/make-options-doc/default.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2023-01-15 14:56:46 +0100
committerpennae <82953136+pennae@users.noreply.github.com>2023-01-22 17:08:40 +0100
commitdf09c21fb262ed07f01099625ef9310a8a8392ae (patch)
treee2ae96e7be4140d239ca410d1cc39efcb4b0f095 /nixos/lib/make-options-doc/default.nix
parent45a5c01a26e8fc5752a2bc969977ffc5e9cadac6 (diff)
downloadnixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar.gz
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar.bz2
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar.lz
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar.xz
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.tar.zst
nixpkgs-df09c21fb262ed07f01099625ef9310a8a8392ae.zip
nixos/documentation: deprecate docbook option docs
following the plan in https://github.com/NixOS/nixpkgs/pull/189318#discussion_r961764451

also adds an activation script to print the warning during activation
instead of during build, otherwise folks using the new CLI that hides
build logs by default might never see the warning.
Diffstat (limited to 'nixos/lib/make-options-doc/default.nix')
-rw-r--r--nixos/lib/make-options-doc/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix
index e2ed7bb7188..7595b66771a 100644
--- a/nixos/lib/make-options-doc/default.nix
+++ b/nixos/lib/make-options-doc/default.nix
@@ -139,9 +139,10 @@ in rec {
       dst=$out/share/doc/nixos
       mkdir -p $dst
 
+      TOUCH_IF_DB=$dst/.used-docbook \
       python ${./mergeJSON.py} \
         ${lib.optionalString warningsAreErrors "--warnings-are-errors"} \
-        ${lib.optionalString (! allowDocBook) "--error-on-docbook"} \
+        ${if allowDocBook then "--warn-on-docbook" else "--error-on-docbook"} \
         ${lib.optionalString markdownByDefault "--markdown-by-default"} \
         $baseJSON $options \
         > $dst/options.json
@@ -153,6 +154,14 @@ in rec {
       echo "file json-br $dst/options.json.br" >> $out/nix-support/hydra-build-products
     '';
 
+  optionsUsedDocbook = pkgs.runCommand "options-used-docbook" {} ''
+    if [ -e ${optionsJSON}/share/doc/nixos/.used-docbook ]; then
+      echo 1
+    else
+      echo 0
+    fi >"$out"
+  '';
+
   # Convert options.json into an XML file.
   # The actual generation of the xml file is done in nix purely for the convenience
   # of not having to generate the xml some other way