Docbook introduced quite a bit of pain. Personally, I had a lot of pain with merge conflicts and release notes, as xml isn’t the most friendly manually edit. Not to mention docbook has some 300+ different element and attribute types; so it quite daunting to know how to leverage it. Also, docbook isn’t very popular, so it’s quite uncommon for people to have previous experience with it (myself included). However, markdown is almost universally used, much easier to edit, and quite light on ideas and concepts which need to be learned, it can be learned essentially in a few minutes.
Probably the final nail in the coffin was this PR #68020. After that point, I think the entire community was convinced that docbook should be moved away from. RFC 72 was just the facilitation of that transition.
Thanks for the link and added context.
I’m curious about the feasibility of using mdBook for consistency at some point.
So invoking pandoc to generate a derivation wasn’t a good fit? I’m probably not following what is meant here.
Docbook sounds nice for documentation that has stricter output requirements and full time experts at the wheel.
The ubiquity of markdown throughout GitHub and contributors likely exposure makes CommonMark a much better fit in my mind!
So invoking pandoc to generate a derivation wasn’t a good fit? I’m probably not following what is meant here.
We run the generate script outside-of-nix because if pandoc was part of the build closure for the manual, then any change to a one of the dependencies of pandoc, would also cause a change in the manual. Also, for consumers of isoImage.includeSystemBuildDependencies and similar “copy all build dependencies” utilities, it would require shipping ghc and quite a few other dependencies.
CommonMark files -> Pandoc (at authoring time) -> Docbook files (in repo) -> Docbook -> HTML
??? -> Man pages
Considerations
The reason that NixOS and Nixpkgs are not the same is because the NixOS manual is built whenever we build a new generation of NixOS, so any tools used by the NixOS manual end up in the NixOS build closure. We’d prefer to avoid having Pandoc in there. Ideally, we’d find a tool that has a very small footprint that runs very quickly to avoid bloating NixOS.
Probably suitable for nixpkgs and NixOS, but might not have as many features as people want for the nixpkgs manual and doesn’t have as much resources or development time behind it as the other options.
mdbook
This is a good choice for nixpkgs considering it is already in use for nix. I suspect the Rust toolchain may be too heavy for NixOS, but I haven’t put in the work to verify this.
This summary is a great introduction to how the Nix community does documentation!
I do not fully understand how packages are built within NixOS, but I do have experience compiling Rust programs for various targets. One of the nice things is that you do not need the Rust toolchain
installed to use a binary written in Rust.
For my benefit, does that not apply here because mdBook’s derives from the Rust toolchain?
I also won’t have anywhere near as deep an understanding as you @ryantm but just shoving lsd (a rust tool) into a quick buildLayeredImage and the only dependencies for running are as follows:
That enlightens me further to nix packaging design. I better understand the tradeoffs.
As a lazy developer I often forsake trust and reproducibility for a blob that works. That said, I’m often deploying blobs in an already trusted context .
mdbook has a significantly larger build closure than mmdoc:
$ nix path-info -Sh $(nix-build -A mmdoc.inputDerivation)
this derivation will be built:
/nix/store/4ahj4hqz6g8s6125969zwyrm3g7x3ljl-mmdoc-0.7.0.drv
building '/nix/store/4ahj4hqz6g8s6125969zwyrm3g7x3ljl-mmdoc-0.7.0.drv'...
/nix/store/xxd04wgymyslbmin9j27zgln76pj7056-mmdoc-0.7.0 370.4M
$ nix path-info -Sh $(nix-build -A mdbook.inputDerivation)
this derivation will be built:
/nix/store/fjxx3zvws3rzqd57381bbn15gv6hyjnd-mdbook-0.4.9.drv
these 2 paths will be fetched (16.67 MiB download, 18.59 MiB unpacked):
/nix/store/fn82kfxpbywwx674fkrqjaykdyh0gvrz-mdbook-0.4.9-vendor.tar.gz
/nix/store/ys2j5l132r6x0k7h05pwb8v63vhhpbxf-source
copying path '/nix/store/fn82kfxpbywwx674fkrqjaykdyh0gvrz-mdbook-0.4.9-vendor.tar.gz' from 'https://cache.nixos.org'...
copying path '/nix/store/ys2j5l132r6x0k7h05pwb8v63vhhpbxf-source' from 'https://cache.nixos.org'...
building '/nix/store/fjxx3zvws3rzqd57381bbn15gv6hyjnd-mdbook-0.4.9.drv'...
/nix/store/xwhqgz1dwm59vx9s7ix83nai3g29h5ca-mdbook-0.4.9 1.6G
We run the generate script outside-of-nix because if pandoc was part of the build closure for the manual, then any change to a one of the dependencies of pandoc, would also cause a change in the manual.
The manual is reproducible, isn’t it? An idea to avoid rebuilds due to pandoc could be to make it fixed output.
That’s mostly off-topic for the discussion, but in general I don’t think we have truly good solutions for writing “larger than a comment” docs, as markdown format is limited. My long-term bet is to wait until asciidoctor publishes a spec and grows independent, embeddable implementations. As a language, asciidoctor is meaningfully better than markdown and I use it for smaller projects. As a toolchain and ecosystem, it needs to grow beyond “single primary ruby implementation”.
asciidoc-py is the original implementation from 2002, with asciidoctor appearing in 2013, and Eclipse Austen is an in-progress implementation for running on the JVM (although I don’t actually see any code in their gitlab instance repo)
What are the meaningful benefits to AsciiDoc over markdown?
From this overview from the asciidoctor documentation I’m not seeing much beyond anchors and cross references are properly supported.
Admonitions, sidebars, and includes might be nice.
Also they hammer home implementations and extensions are a bit random but I don’t think any of this is a concern for our documentation.
The negatives of switching would be converting all existing md documentation to asciidoc and limiting ourselves to 2 (or 3) implementations when markdown has a wide selection, much more usage, much better understanding across the maintainer-base
Either way once we first simplify the documentation story here any kind of converting the format should also be easier
Am I correct in thinking the only option that doesn’t have rustc in the build closure is mmdoc? Sphinx has started depending on it via Python’s cryptography package, IIUC:
we’ve tried to extend mmdoc with syntax extensions needed to render the current set of partially converted option docs, and we do not have the patience to deal with doing string processing in C. the experience using python and mistune 2 has been rather smooth though, and mistune itself seems to be pretty fast as well. at this point it seems that porting mmdoc to use python+mistune instead may be an excellent option since that would increase the system closure size by nothing at all, and would probably be more maintanable for the future as well.