Commit graph

72 commits

Author SHA1 Message Date
Naïm Favier bff4bb5540
Merge pull request #208762 from ncfavier/link-manpages-options-doc 2023-01-09 11:57:01 +01:00
Naïm Favier fb1bc8de93
lib/modules: make mkAliasOptionModule emit DocBook
Follow-up to https://github.com/NixOS/nixpkgs/pull/208407

Removing `mdDoc` isn't enough, we need to emit actual DocBook.
2023-01-08 22:44:18 +01:00
Domen Kožar dce3b02d44
Merge pull request #209501 from sandydoo/improve/fix-commonmark-doc-isues
nixos/make-options-doc: skip re-escaping literal expressions
2023-01-08 11:14:57 +00:00
sandydoo 18df33f5bc
nixos/make-options-doc: skip re-escaping strings 2023-01-08 08:52:17 +00:00
pennae 9da5f12ecf modules: add mkPackageOptionMD
another transitional option factory, like mkAliasOptionModuleMD.
2023-01-05 02:33:13 +01:00
pennae 4c1cfbdb84 modules: add mkAliasOptionModuleMD
mkAliasOptionModule should not default to mdDoc descriptions because
that can break out-of-tree users of documentation infrastructure. add an
explicitly-MD variant for now, to be removed some time after the MD
transition is complete.
2023-01-05 02:33:13 +01:00
Naïm Favier f61e538c43
nixos/make-options-doc: link manpages
Add links to manpages without a link using the mapping defined in
`doc/manpage-urls.json`, as is already done for the nixpkgs and NixOS
manuals.
2023-01-03 14:03:35 +01:00
K900 2d3cf010fe
Revert "treewide: use nativeBuildInputs with runCommand instead of inlining" 2022-12-26 21:05:35 +03:00
Sandro 5af3f865e8
Merge pull request #206775 from SuperSandro2000/runCommand-nativeBuildInputs 2022-12-25 21:42:05 +01:00
Sandro Jäckel 26f704b545
treewide: use nativeBuildInputs with runCommand instead of inlining 2022-12-18 23:36:40 +01:00
figsoda 6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Naïm Favier 109f8b4657 nixos/make-options-doc: remove dead code
The logic for pretty-printing Nix values isn't needed any more because
`optionAttrSetToDocList` returns already rendered values.
2022-12-08 17:52:52 +01:00
Naïm Favier 6a117e2759 nixos/doc: render option values using lib.generators.toPretty
Render un`_type`d defaults and examples as `literalExpression`s using
`lib.generators.toPretty` so that consumers don't have to reinvent Nix
pretty-printing. `renderOptionValue` is kept internal for now intentionally.

Make `toPretty` print floats as valid Nix values (without a tilde).

Get rid of the now-obsolete `substSpecial` function.

Move towards disallowing evaluation of packages in the manual by
raising a warning on `pkgs.foo.{outPath,drvPath}`; later, this should
throw an error. Instead, module authors should use `literalExpression`
and `mkPackageOption`.
2022-12-08 17:52:52 +01:00
sandydoo 3564228a10
nixos/make-options-doc: improve CommonMark formatting
Render the `type` attribute in a code block to match the rest of the
attributes.
2022-12-07 14:39:26 +00:00
sandydoo 926afb6f1c
nixos/make-options-doc: pretty-print literals
Unlike the XML doc renderer, the AsciiDoc and CommonMark renderers don't
pretty-print certain complex types, like literal expressions, DocBook
literals, and derivations. These types are dumped into the documentation
as JSON.

This commit parses and unwraps these types when loading the
JSON-formatted NixOS options. The AsciiDoc and CommonMark renders have
also been combined into a single script to allow code reuse.
2022-12-07 14:06:56 +00:00
Robert Hensing b106ff14ed nixosOptionsDoc: Report in which option an error occurs 2022-11-11 06:47:30 +01:00
Robert Hensing 429ba6c714 nixosOptionsDoc: Add markdownByDefault parameter 2022-11-11 06:29:44 +01:00
Domen Kožar e190302018 nixos options markdown: fix html escaping
\<foo\> will often be displayed like \<foo>, for example by mkdocs.

I've tested a number of markdown renderers and they render html escape
sequences fine.
2022-11-05 21:20:01 +00:00
Winter f540aeda6f nixos/make-options-doc: fix JSON generation on Darwin 2022-10-25 22:58:50 -04:00
Jan Tojnar 457f28f6f8 Merge branch 'master' into staging-next
; Conflicts:
;	pkgs/development/tools/codespell/default.nix

codespell 2.2.2 switched to pyproject & setuptools_scm:
https://github.com/codespell-project/codespell/pull/2523
2022-10-19 05:24:28 +02:00
Robert Hensing 6259b29f29
Merge pull request #194035 from Ma27/show-option-quoting
lib/options/showOption: fix quoting of attr-names that are not identifiers
2022-10-18 11:31:54 +02:00
Maximilian Bosch 2480532bd1
nixos/doc: fix build
Now we even have options like
`services.listmonk.database.settings."app.notify_emails"` shown
correctly (i.e. with quotes).
2022-10-09 10:13:21 +02:00
Artturin 09226fffcf nixosOptionsDoc: buildInputs -> nativeBuildInputs
to make strictDepsByDefault work
2022-10-07 19:26:22 +03:00
Robert Hensing 91879ce160 make-options-doc: Make optionIdPrefix configurable ("opt-") 2022-09-29 12:34:06 +02:00
Robert Hensing 5b52d552cb nixos/make-options-doc: Explain docbook to markdown migration 2022-09-17 13:38:23 +01:00
pennae 767485a0de 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.
2022-09-10 18:23:13 +02:00
pennae 9c3c13b50d nixos/make-options-doc: add inline roles for varname/envar
both of these render distinctly from plain literals in the manpage, and
manpages even semantically distinguish between the two.
2022-08-31 16:21:10 +02:00
pennae 65fd6f0774 nixos/make-options-doc: eat newlines in MD admonitions
leaving some newlines around after an admonition was closed causes the
newline rule to match, which in turn inserts literallayout newlines into
te xml output. that's not what we want.
2022-08-27 19:18:29 +02:00
Robert Schütz 243053e521 python310Packages.mistune: 0.8.4 -> 2.0.4
Remove mistune_0_8 because it's insecure.
2022-08-15 06:53:01 +00:00
pennae af98bacbe0 Revert "nixos/docs: cache mergeJSON md conversion on baseOptionsJSON"
This reverts commit 52b0ad17e3.

we only needed this because mergeJSON was slow, but in the interim we
found a better solution to the slowness.
2022-08-05 17:13:47 +02:00
pennae 645cfa59ac nixos/make-option-docs: add xref support to markdown conversion 2022-08-03 22:01:14 +02:00
pennae 7a091b2686 nixos/make-options-doc: reuse markdown instance in mergeJSON
this doesn't construct a new (expensive) parser for every option, making
rendering about 30x faster.
2022-08-03 22:00:24 +02:00
pennae 52b0ad17e3 nixos/docs: cache mergeJSON md conversion on baseOptionsJSON
with ever more options being markdown rather than docbook the conversion
time is starting to become a significant factor of doc build time.
luckily we can pre-convert all nixos option docs to MD and cache the
result of this conversion, then merge the already-converted json file
with user option docs. we leave options.json unconverted to keep it as
close to the actual nix code as possible.
2022-07-28 23:20:02 +02:00
pennae 18be724a58 nixos/make-options-doc: give MD conversion error locations
during docs conversion it can be very useful to know exactly *where* the
error the script complained about is. the name of the option should be
sufficient since option merging is rather rare, and won't merge doc
attributes anyway.
2022-07-28 20:03:02 +02:00
Robert Hensing 7c81905344 nixos/make-options-doc: Support Nix-provided declaration locations
Feature was introduced in https://github.com/NixOS/nixpkgs/pull/174460,
but wasn't supported in `mergeJSON.py` yet.
2022-06-27 22:07:20 +02:00
Robert Hensing 8bff3fef40 nixos/make-options-doc: Support block quotes
Our tooling would trip without the inner <para>, despite the docbook
docs suggesting that <para> occurs in <blockquote> and vice versa.
2022-06-27 17:41:32 +02:00
Robert Hensing e04aa1bcd9 nixos/make-options-doc: Escape inline code and code blocks 2022-06-27 17:41:32 +02:00
Robert Hensing f900ed1749 nixos/make-options-doc: Support newline md node
This occurs in the ast generated for blockquotes.
2022-06-27 17:41:32 +02:00
Robert Hensing bccc3e747b nixos/make-options-doc: Fix exception handler for arity /= 1 methods 2022-06-27 17:41:32 +02:00
Robert Hensing aff2dbbc82 make-options-doc: Make variablelist id configurable
I've tried XInclude set-xml-id first, but our tooling did not pick up on it.
2022-06-27 17:41:32 +02:00
Robert Hensing fa9c83ca7f
Merge pull request #174460 from hercules-ci/module-docs-Nix-driven-location-links
make-options-doc: Support Nix-provided declaration links
2022-06-22 15:48:46 +02:00
Robert Hensing cee66a8cd5 make-options-doc: Support Nix-provided declaration links
Previously, the location logic was hardcoded, supporting only
Nixpkgs and NixOps properly, leaving other uses of the module
system without good location support.
2022-06-15 00:45:05 +02:00
pennae 320aa2a791 treewide: attempt at markdown option docs 2022-06-12 12:44:38 +02:00
Robert Hensing 75bc6da237 make-options-doc: Filter options after transformOptions
This allows the user-supplied function to change the visibility
of options.
2022-05-25 12:50:07 +02:00
Robert Hensing 90344e9f40
Merge pull request #171163 from hercules-ci/nixpkgs-config-doc
Add generated `nixpkgs.config` doc to Nixpkgs manual
2022-05-19 20:51:38 +02:00
Robert Hensing 0b02135d3b nixosOptionsDoc: refactor
Thanks to Infinisil for pointing this out.
2022-05-16 22:53:23 +02:00
Robert Hensing 062bc5e74a lib.types.functionTo: Add pseudo-attr to generated docs 2022-05-13 09:01:05 +02:00
Robert Hensing bb2c5a3684 nixosOptionsDoc: Make appendix tag optional 2022-05-01 21:51:19 +02:00
Silvan Mosberger 25de2935ef lib/modules: Document _module.args
Documents the _module.args option, motivated by many usages in Flakes,
especially with the deprecation of extraArgs
(78ada83361)

The documentation rendering for this option had to be handled a bit
specially, since it's not declared in nixos/modules like all the other
NixOS options.

Co-Authored-By: pennae <github@quasiparticle.net>
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2022-04-05 18:26:40 +02:00
Janne Heß 0c766a100e lib/options: Throw error for options without a type
Makes all options rendered in the manual throw an error if they don't
have a type specified.

This is a follow-up to #76184

Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2022-02-28 22:51:41 +01:00