diff options
author | pennae <github@quasiparticle.net> | 2022-09-01 19:23:59 +0200 |
---|---|---|
committer | pennae <82953136+pennae@users.noreply.github.com> | 2022-09-10 18:23:13 +0200 |
commit | 767485a0dee24329e2b34cd4af0c08ea21e959ea (patch) | |
tree | 13a42cff4608334fcd9f6f21e5a5758020782d7b /nixos/lib/make-options-doc/default.nix | |
parent | 8c309aa43ae9e5e4dbdd542e4e5e49253d3dd763 (diff) | |
download | nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar.gz nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar.bz2 nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar.lz nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar.xz nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.tar.zst nixpkgs-767485a0dee24329e2b34cd4af0c08ea21e959ea.zip |
lib/options: deprecate docbook text and literalDocBook
deprecate literalDocBook by adding a warning (that will not fire yet) to its uses and other docbook literal strings by adding optional warning message to mergeJSON.
Diffstat (limited to 'nixos/lib/make-options-doc/default.nix')
-rw-r--r-- | nixos/lib/make-options-doc/default.nix | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix index 3f98e2cf87b..43dbff0e68d 100644 --- a/nixos/lib/make-options-doc/default.nix +++ b/nixos/lib/make-options-doc/default.nix @@ -34,6 +34,10 @@ # instead of printing warnings for eg options with missing descriptions (which may be lost # by nix build unless -L is given), emit errors instead and fail the build , warningsAreErrors ? true +# allow docbook option docs if `true`. only markdown documentation is allowed when set to +# `false`, and a different renderer may be used with different bugs and performance +# characteristics but (hopefully) indistinguishable output. +, allowDocBook ? true }: let @@ -127,26 +131,23 @@ in rec { ]; options = builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsNix)); + # merge with an empty set if baseOptionsJSON is null to run markdown + # processing on the input options + baseJSON = + if baseOptionsJSON == null + then builtins.toFile "base.json" "{}" + else baseOptionsJSON; } '' # Export list of options in different format. dst=$out/share/doc/nixos mkdir -p $dst - ${ - if baseOptionsJSON == null - then '' - # `cp $options $dst/options.json`, but with temporary - # markdown processing - python ${./mergeJSON.py} $options <(echo '{}') > $dst/options.json - '' - else '' - python ${./mergeJSON.py} \ - ${lib.optionalString warningsAreErrors "--warnings-are-errors"} \ - ${baseOptionsJSON} $options \ - > $dst/options.json - '' - } + python ${./mergeJSON.py} \ + ${lib.optionalString warningsAreErrors "--warnings-are-errors"} \ + ${lib.optionalString (! allowDocBook) "--error-on-docbook"} \ + $baseJSON $options \ + > $dst/options.json brotli -9 < $dst/options.json > $dst/options.json.br |