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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: migrate trivial files to doc-comment format #299986

Merged
merged 4 commits into from Apr 4, 2024

Conversation

hsjobeki
Copy link
Contributor

@hsjobeki hsjobeki commented Mar 29, 2024

Description of changes

Some files in /lib are trivial to migrate to doc-comments. Those are included here.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 馃憤 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Mar 29, 2024
@hsjobeki
Copy link
Contributor Author

hsjobeki commented Mar 29, 2024

Reading through the types.nix file. I just notice how bad the module system types are documented. This could be something very impactful to document!

@lolbinarycat
Copy link
Contributor

it looks as though this is just a string replacement of /* with /**.

remember, documentation that is only relevant to nixpkgs contributors does not belong in the manual.

and commented out code defiantly does not belong in the manual.

@hsjobeki
Copy link
Contributor Author

Oops. Right you are talking about test/misc.nix.
It is a little more than just a string replacement. Also a migration to Markdown/Commonmark.

This PR belongs to this one: #262987 there it is obvious that it is not just a string replacement.

@lolbinarycat
Copy link
Contributor

doc comments can be useful, but i would also like to note a few things:

  1. overuse of individual function doc comments can lead to lower quality documentation that never explains the operation of the library as a whole
  2. markdown-formatted doc comments are harder for editors to perform syntax highlighting on than external markdown documentation

i think the best approach is to have doc comments be supplemental to the existing nix manual, instead of replacing it.

additionally, you seem to have turned a few file-header comments into doc comments, and it's not clear how or if these should be rendered into the manual (probably not, since they mostly explain implementation details)

@hsjobeki
Copy link
Contributor Author

hsjobeki commented Mar 30, 2024

馃憤 Noted.

you seem to have turned a few file-header comments into doc comments, and it's not clear how or if these should be rendered into the manual

We have the tools to render them in the manual currently. see e.g.:
https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-strings
-> "String manipulation functions."

This stems from the "file header" of lib/strings.nix.

For 2. see my (draft) PR: nix-community/nixdoc#114

Yes, markdown has bad support when being inlined but i feel like this is something we have to deal with. Since rfc74 all nix documentation is markdown. And since rfc145 all doc-comments are markdown.

We still need to decide which comments are doc-comments which is the fair point you got here.

overuse of individual function doc comments can lead to lower quality documentation that never explains the operation of the library as a whole.

Doc-comments explain individual functions or attributes or pieces of code that are user facing APIs. They are not meant to explain the whole library or abstract concepts. If that is missing then we need to write it. And this might not be something a doc-comment can do for you.

lib/default.nix Outdated Show resolved Hide resolved
lib/kernel.nix Outdated Show resolved Hide resolved
lib/tests/misc.nix Outdated Show resolved Hide resolved
lib/tests/misc.nix Outdated Show resolved Hide resolved
lib/tests/misc.nix Outdated Show resolved Hide resolved
lib/tests/systems.nix Outdated Show resolved Hide resolved
@infinisil
Copy link
Member

Reading through the types.nix file. I just notice how bad the module system types are documented. This could be something very impactful to document!

lib.types are decently documented, just in the NixOS manual: https://nixos.org/manual/nixos/stable/#sec-option-types

It would be great to move the doc source into doc comments!

@hsjobeki
Copy link
Contributor Author

hsjobeki commented Apr 2, 2024

Reading through the types.nix file. I just notice how bad the module system types are documented. This could be something very impactful to document!

lib.types are decently documented, just in the NixOS manual: https://nixos.org/manual/nixos/stable/#sec-option-types

It would be great to move the doc source into doc comments!

Right didn't look there. I'll try to move the stuff in a separate PR.

Copy link
Member

@DanielSidhion DanielSidhion left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple adjustments needed imo, but feel free to consider it approved after they're dealt with.

lib/tests/misc.nix Outdated Show resolved Hide resolved
lib/tests/systems.nix Outdated Show resolved Hide resolved
Thanks @DanielSidhion

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
lib/types.nix Show resolved Hide resolved
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

(reviewed during the docs team meeting)

Looking good!

@infinisil infinisil merged commit c0f5f27 into NixOS:master Apr 4, 2024
7 of 8 checks passed
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2024-04-04-documentation-team-meeting-notes-117/42754/1

github-actions bot pushed a commit to Mic92/nixpkgs that referenced this pull request Apr 7, 2024
* doc: migrate trivial files to doc-comment format

* fix: revert some comments

* Apply suggestions from code review

Thanks @DanielSidhion

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>

* Update lib/types.nix

---------

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants