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

nixos/*: tag manpage references #377184

Merged

Conversation

pbsds
Copy link
Member

@pbsds pbsds commented Jan 27, 2025

This is basically the second commit in #377170 on steroids, candidate for #346453

Candidates were made using

#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p ripgrep sd jq git

git restore .

# convert foobar(1) manpage references to {manpage}`foobar(1)`
while read fname; do
    echo $fname

    # list all found manpage references
    # rg '[a-zA-Z.-]+\([0-9]+\)' "$fname" --json | jq '.data.submatches[]?.match.text' -r | sort -u

    (set -x
        sd ' `([a-zA-Z.-]+\([0-9]+\))`' ' {manpage}`$1`' "$fname"
        sd '\(`([a-zA-Z.-]+\([0-9]+\))`\)' '({manpage}`$1`)' "$fname"
        sd '\b([a-zA-Z.-]+\([0-9]+\))' '{manpage}`$1`' "$fname"
        # undo double manpage tagging
        sd '\{manpage\}`\{manpage\}`([a-zA-Z.-]+\([0-9]+\))``' '{manpage}`$1`' "$fname"
    )

done < <(rg '[a-zA-Z.-]+\([0-9]+\)' -tnix nixos/ -l)

git restore nixos/tests

and picked with GIT_DIFF_OPTS='--unified=20' git add -p for improved context.

The second commit was made using

jq <doc/manpage-urls.json 'to_entries[] | "rg -F \"[\(.key)](\(.value))\" nixos/ -l | xe sd -F \"[\(.key)](\(.value))\" \"{manpage}`\(.key)`\""' -r  | tr \" \' | bash -x

The third commit and onward are manual cleanups and fixes


The next stage is to either (a) expand doc/manpage-urls.json with more urls or (b) add https://linux.die.net/man/ as a fallback, or (c) both. (see #208762.)

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 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: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: nixos-container Imperative and declarative systemd-nspawn containers 6.topic: systemd 6.topic: k3s Kubernates distribution (https://k3s.io/) 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jan 27, 2025
@pbsds pbsds force-pushed the fix-nixos-manpage-references-1737940344 branch from 3a4e2a4 to b5f6a06 Compare January 27, 2025 01:26
@pbsds pbsds added the 6.topic: documentation Meta-discussion about documentation and its workflow label Jan 27, 2025
@pbsds pbsds marked this pull request as ready for review January 27, 2025 01:28
@pbsds pbsds requested a review from philiptaron January 27, 2025 01:29
pbsds added 4 commits January 27, 2025 02:47
Made with:

jq <doc/manpage-urls.json 'to_entries[] | "rg -F \"[\(.key)](\(.value))\" nixos/ -l | xe sd -F \"[\(.key)](\(.value))\" \"{manpage}`\(.key)`\""' -r  | tr \" \' | bash -x

(requires ripgrep, sd and xe)
@pbsds pbsds force-pushed the fix-nixos-manpage-references-1737940344 branch from b5f6a06 to 5e6998a Compare January 27, 2025 01:48
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

I didn't check every manpage directly, but the ones I did check were present. This looks correct.

@@ -194,7 +194,7 @@ in
DAEMON = mkOption {
default = { };
description = ''
This section lists long running daemons to start before any SERVICES are spawned. master(8) will ensure that these processes are running, restarting any process which dies or forks. All listed processes will be shutdown when master(8) is exiting.
This section lists long running daemons to start before any SERVICES are spawned. {manpage}`master(8)` will ensure that these processes are running, restarting any process which dies or forks. All listed processes will be shutdown when {manpage}`master(8)` is exiting.
Copy link
Contributor

Choose a reason for hiding this comment

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

https://linux.die.net/man/8/master

I didn't think this was real but it is

@@ -546,7 +546,7 @@ in
type = lib.types.lines;
default = "";
description = ''
Additional entries to put verbatim into aliases file, cf. man-page aliases(8).
Additional entries to put verbatim into aliases file, cf. man-page {manpage}`aliases(8)`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this PR, but having a style guide for how to refer to a manpage (man-page? Nothing?) would be nice. @NixOS/documentation-team

@@ -73,7 +73,7 @@ in
});
description = ''
This cell's database server records, added to the global
CellServDB. See CellServDB(5) man page for syntax. Ignored when
CellServDB. See {manpage}`CellServDB(5)` man page for syntax. Ignored when
Copy link
Contributor

Choose a reason for hiding this comment

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

https://man.openbsd.org/OpenBSD-5.2/CellServDB.5

Disappears from the OpenBSD man pages after 5.2 👀

@philiptaron philiptaron merged commit d9b725d into NixOS:master Jan 27, 2025
34 of 36 checks passed
@pbsds
Copy link
Member Author

pbsds commented Feb 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: documentation Meta-discussion about documentation and its workflow 6.topic: k3s Kubernates distribution (https://k3s.io/) 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: nixos-container Imperative and declarative systemd-nspawn containers 6.topic: systemd 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants