Skip to content
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

doc/lib-functions: remove warnings, add versions, cli #205643

Merged
merged 4 commits into from
Dec 22, 2022

Conversation

ncfavier
Copy link
Member

@ncfavier ncfavier commented Dec 11, 2022

Building the nixpkgs manual currently triggers a bunch of deprecation warnings, because every attribute in lib is evaluated to see if it's an attrset to generate locations for.

Instead, share the lib subsets to include in the documentation between lib-function-docs and lib-function-locations so they can coordinate.

I also wanted to add modules (the upcoming lib.modules.typeCheck{,ing} might especially be worth documenting) but there are several obstacles:

  • that file contains many functions that are too internal to be exposed in the docs. Maybe they should actually be made local, or split into a different file if we don't want to break the API?
  • nixdoc generates documentation for non-toplevel local functions like collectStructuredModules (which then fail the build because they try to include location information that wasn't generated).

Fixes #116472

@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Dec 11, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 11, 2022
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please implement @roberth's suggestions.

@ncfavier
Copy link
Member Author

ncfavier commented Dec 12, 2022

I struggled a bit with XML but here we go.

Note that the list of sections is ordered alphabetically now, which is probably better?

I also bumped the generate.section.toc.level so that we get TOCs for X.Y sections.

screenshot-2022-12-12-121504

@fricklerhandwerk
Copy link
Contributor

@ncfavier good point about the ordering, that indeed eluded me. I'm skeptical about changing the order haphazardly, as it (implicitly, but still) tells readers of the TOC something about relative importance and can be used to guide their attention.

Even if it's more cumbersome I'd prefer to instead pass the sections around as a list. @roberth what do you think?

@roberth
Copy link
Member

roberth commented Dec 12, 2022

it (implicitly, but still) tells readers of the TOC something about relative importance and can be used to guide their attention.

I don't think the ordering was particularly good, but I guess it works?

relative importance

Seems a bit fanciful for independent pieces of reference documentation.


Perhaps it may be helpful (for the TOC) to start the section names with lib.${name}, or just ${name}:

@fricklerhandwerk
Copy link
Contributor

Seems a bit fanciful for independent pieces of reference documentation.

People will still tend to attempt reading it back to back in lack of other resources, so we may as well not be in the way of finding the most relevant things first.

@ncfavier
Copy link
Member Author

Perhaps it may be helpful (for the TOC) to start the section names with lib.${name}, or just ${name}:

Done, but nixdoc escapes < to &gt; so can't wrap it in <literal>.

Building the nixpkgs manual currently triggers a bunch of deprecation
warnings, because every attribute in `lib` is evaluated to see if it's
an attrset to generate locations for.

Instead, share the lib subsets to include in the documentation
between `lib-function-docs` and `lib-function-locations` so they can
coordinate.

Also generate the list of sections instead of duplicating it in
`library.xml`.
@ofborg ofborg bot added 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 22, 2022
@infinisil infinisil merged commit 7ba7b45 into NixOS:master Dec 22, 2022
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-42/24204/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nixpkgs manual: warning: lib.readPathsFromFile is deprecated
5 participants