New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Doxygen Docs for Nixpkgs Internals #34558
Conversation
Very nice! I have a personal preference for Sphinx, but regardless I think this is very good to have and we should get this in. I wonder though what others think of changing the format of the docstrings. |
0ff33f6
to
6f803bd
Compare
(I added the python tag to check a hypothesis w.r.t. the incorrect label added by ofborg. I'll remove it shortly, sorry for the noise) @GrahamcOfBorg eval |
I had thought about this long ago, but I didn't realize it could work to use a different language ❤️ Sphinx takes data via doxygen, at least in projects I know about. |
@FRidh I totally agree! Sphinx definitely has a nicer looking theme by default. Doxygen lets you create a custom template, so I was thinking of mimicking the NixOS.org styling. I've got the header on the demo page here. @vcunat Sort of a happy accident that it works since Doxygen is in c++ mode. Other modes may work better, although the "best" would be to write a Nix language definition. Glad you like it! |
Right. That's still an option then. @lukeadams could you look how to integrate this in the Nixpkgs manual? Doxygen supports docbook output. http://doxygen.nl/manual/config.html#cfg_generate_docbook When we have that available, we could consider looking further than just |
@FRidh With that option enabled, I just have to add Doxygen generation to doc/default.nix and tell the docstring builder to look at its output. I've now labelled strings.nix as a member of |
(Sorta) got it linked into the manual here. Needs some massaging to make it look good though. |
I've been looking for such documentation and happy that someone finally commits to writing it. |
I like the general idea, but I find the markup to be uber ugly.
We already have the documentation that many people (including me) hate to edit because of docbook XML, now it seems to me that you want make me hate to edit the lib because of this Javadoc-style @trash.
No offense, my problem is not with this PR specifically, but with @trash in general.
I would love to have exactly this idea implemented with `haddock` instead of `doxygen`. `haddock` docstrings are beautiful.
Also, `haddock` parses Haskell, nix is more like Haskell than like C++.
|
@oxij I'll look into it! Doxygen was just for proof of concept since I was already familiar with it. Oh yeah not sure if you noticed but in many cases I had to wrap lib code with |
@FRidh Honestly I think Sphinx would be the best option with a custom domain (link up top) which would add Nix support to it. Additionally, the inbuilt sphinx.Napoleon extension supports a docstring style similar to what we already have in-tree. Doxygen requires too much hacking to work reliably and its Docbook output requires quite a bit of massaging to embed in the manual. Thoughts? |
Motivation for this change
This PR demonstrates a low friction way to autogenerate documentation for Nixpkgs lib functions.
Doxygen does a pretty decent job picking up the correct function name (although it thinks they are variables) under the C++ generator.
A demo can be seen here.
I haven't converted all of strings.nix, but the functions with code-formatted examples have been converted.
TODO
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)