Commit Graph

816 Commits

Author SHA1 Message Date
pennae
9ff987764c nixos/make-options-doc: enable smartquotes and replacements
the rest of the nixos manual has them enabled, so we should enable them
here too for consistency.

this changes rendered output pervasively. changes also include quotes in
types (eg in `strings concatenated with "\n"`), but since those are not
code this is probably fine. if not we can probably add a myst role to
inhibit replacements.
2023-01-26 00:38:06 +01:00
pennae
de22a26b4c nixos/make-options-doc: render option types through md
no changes to rendered output, but options.xml loses a few spaces.
2023-01-26 00:38:06 +01:00
pennae
6b677d9148 nixos/make-options-doc: disable inline html
we target not only html, but also manpages. inline html is not helpful
for the latter.
2023-01-26 00:38:06 +01:00
pennae
ba1f533134 nixos/make-option-docs: wrap md parser+renderer into Converter
the new rendering tool will consist of a number of different Converters,
each with a possibly specialized Renderer.
2023-01-26 00:38:06 +01:00
pennae
3e45994a3b nixos/make-options-doc: don't use inspect for optionsToDocbook
the rules are fixed, and we want to support all of them (or throw a
useful error message). this will also become the base for a generic
renderer system, so let's just list all the rules statically.
2023-01-26 00:38:06 +01:00
Robert Hensing
d255493e8f nixos/optionsToDocbook.py: Add docbook ns for when the appendix tag is omitted 2023-01-26 00:32:56 +01:00
pennae
0175a91aa3 nixos/make-options-doc: split docbook conversion from mergeJSON
this restores mergeJSON to its former glory if…merging json, and
extracts the MD rendering into a new script that will run instead of the
py+nix+xslt pipeline we previously ran to convert options.json to docbook.

this change alone gives a noticable performance boost when building
docs (18s instead of 27s to build optionsDocBook).

no changes to rendered output, except for a single example in the
rsnapshot module that uses hard tabs for indentation instead of spaces.
this probably isn't important.

docbook warnings remain with mergeJSON since the other processing steps
output single files instead of directories. since we'll only keep the
check until 23.11 this is probably also not important to fix.

also contains a few improvements to error reporting in the MD renderers.
2023-01-26 00:32:56 +01:00
pennae
381dcd7f9d nixos/make-options-doc: remove program argument to xslt
this doesn't seem to be set anywhere, not from make-options-doc nor
anywhere else.
2023-01-26 00:32:56 +01:00
Andrew Hoff
6ae3e7695e nixos/virtualisation: add option for explicitly named network interfaces
Adds a new option to the virtualisation modules that enables specifying
explicitly named network interfaces in QEMU VMs. The existing
`virtualisation.vlans` is still supported for cases where the name of
the network interface is irrelevant.
2023-01-22 12:20:40 -05:00
pennae
e2019c49d4 nixos/make-options-doc: use markdown-it-py for rendering
only whitespace changes (mostly empty descriptions rendered as literal
line breaks and trailing space toPretty generates, but that were dropped
by mistune).
2023-01-22 17:50:09 +01:00
pennae
248e1b957d nixos/make-options-doc: render related packages with md
don't generate docbook for related packages, generate markdown instead.
this could be extended further to not even generate markdown but have
mergeJSON handle all of the rendering. markdown will work fine for now
though.
2023-01-22 17:50:09 +01:00
pennae
fa8a594c56 nixos/make-options-doc: deprecate \n\n parbreak
only whitespace changes to rendered outputs, all in the vicinity or body
of admonitions. previously admonitions would not receive paragraph
breaks even when they should have because the description postprocessing
did not match on their contents.
2023-01-22 17:50:09 +01:00
pennae
c93e5dde67 nixos/make-options-doc: rearrange paras in related packages/defaults/examples
this mirrors what we will be able to create with markdown. no change to
rendered outputs.
2023-01-22 17:50:09 +01:00
pennae
3a5f1ae029 nixos/make-options-doc: render default/example contents through MD
removes some trailing whitespaces from the html output, no other changes.
2023-01-22 17:50:09 +01:00
pennae
2bd8129a47 nixos/make-options-doc: make whitespace more md-compatible
markdown-it-py creates different whitespace leaders/trailers than are
currently emitted, and when we convert examples and defaults to render
via markdown the spacing will change too. this has no effect on rendered
output.
2023-01-22 17:50:09 +01:00
pennae
d1aa187c0e nixos/make-options-doc: don't escape link urls twice
mistune already does escaping. it does escaping for html, but the
difference is small enough that can just ignore that we're actually
targeting docbook here.
2023-01-22 17:50:09 +01:00
pennae
2cb43da587 nixos/make-options-doc: remove trailing whitespace from strings
this was done only to make the conversion to MD easier to verify. we no
longer need it, and not keeping whitespace does not affect rendered outputs.

stripping will have to stay for now because description postprocessing
would add empty paragraphs otherwise.
2023-01-22 17:50:09 +01:00
pennae
df09c21fb2 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.
2023-01-22 17:08:40 +01:00
Guillaume Girol
33afbf39f6 treewide: switch to nativeCheckInputs
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
2023-01-21 12:00:00 +00:00
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
4fb500d629
nixos/doc: fix some manpage references 2023-01-03 14:03:35 +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
Jacek Galowicz
869545857f
Merge pull request #208354 from bjornfor/nixos-test-driver-quote-shell-args
nixos/test-driver: quote some shell command lines
2022-12-30 22:41:04 +01:00
Bjørn Forsman
c876f0c146 nixos/test-driver: quote some shell command lines
This makes them robust against paths with whitespace.
2022-12-30 13:19:59 +01:00
Bjørn Forsman
4c45c3f8f2 nixos/test-driver: use ASCII single quotes everywhere
A few places used Unicode U+2018/U+2019 left/right single quotes (but
not always correctly balanced). Let's just use plain ASCII single quotes
everywhere.
2022-12-30 13:00:19 +01:00
Bjørn Forsman
ce5644f658 nixos/test-driver: use f-strings instead of .format()
For readability.

Suggested-by: @tfc
2022-12-29 23:51:35 +01:00
Bjørn Forsman
dba49a43a0 nixos/test-driver: add optional address arg to wait_for_{open,closed}_port
This is useful for testing servers configured to listen on specific
addresses.
2022-12-29 13:50:17 +01:00
Naïm Favier
3fc528ff7f
Merge pull request #207095 from ncfavier/linux-custom-kernel 2022-12-27 17:10:43 +01:00
K900
2d3cf010fe
Revert "treewide: use nativeBuildInputs with runCommand instead of inlining" 2022-12-26 21:05:35 +03:00
Jörg Thalheim
ea415d1a38
Merge pull request #207038 from NixOS/make-disk-image-for-uefi
make-disk-image: documentation, UEFI variables recording, improved determinism
2022-12-26 11:02:28 +00:00
Sandro
5af3f865e8
Merge pull request #206775 from SuperSandro2000/runCommand-nativeBuildInputs 2022-12-25 21:42:05 +01:00
Raito Bezarius
22adcaa449 nixos/lib/make-disk-image: docs, UEFI vars recording, more determinism
- Extensive documentation in NixOS manual
- Deterministic mode that fixes various identifiers relative to disk
  partitions and filesystems in ext4 case
- UEFI variable recording
2022-12-24 19:15:29 +01:00
Robert Hensing
7bfb51f9cd
Merge pull request #207441 from hercules-ci/nixos-testing-python-no-more-specialArgs
nixos/testing-python.nix: Help users who need specialArgs
2022-12-24 17:19:32 +01:00
Jacek Galowicz
9938dec682
Merge pull request #170636 from Synthetica9/wait_before_entry
nixos/test-driver: add wait_before_entry
2022-12-23 19:46:23 +01:00
Robert Hensing
d9283c04d5 nixos/testing-python.nix: Help users who need specialArgs 2022-12-23 18:41:52 +01:00
Naïm Favier
84d8b9a809
nixos/systemd: document what scriptArgs is for 2022-12-22 15:17:05 +01:00
Naïm Favier
f677cbabe9
nixos/tests: remove minimal-kernel module
It's not used, doesn't build, and seems like the only reason to have
`manualConfig` take `stdenv` as an argument.
2022-12-22 01:42:15 +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
Artturin
05a2dfd674 lib.replaceChars: warn about being a deprecated alias
replaceStrings has been in nix since 2015(nix 1.10)

so it is safe to remove the fallback

d6d5885c15
2022-12-15 22:25:51 +02: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
Artturi
645b5a2f9f
Revert "nixos/lib: add /home to pathsNeededForBoot" 2022-12-03 15:16:42 +02:00