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/doc: set groff mdoc os registers properly #214307

Closed
wants to merge 1 commit into from

Conversation

pennae
Copy link
Contributor

@pennae pennae commented Feb 3, 2023

Description of changes

the nixpkgs site-tmac sets doc-default-operating-system and doc-volume-operating-system to Nixpkgs, which is mostly correct but somewhat confusing for NixOS manpages. luckily the previous dance was overly complicated and we can instead just change the registers differently if we detect a nixpkgs groff. this also means we can use plain .Os without hard-coding the os as detected by mandoc.

followup from #213256 (comment)

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.05 Release Notes (or backporting 22.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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

the nixpkgs site-tmac sets doc-default-operating-system and
doc-volume-operating-system to Nixpkgs, which is mostly correct but
somewhat confusing for Nix*OS* manpages. luckily the previous dance was
overly complicated and we can instead just change the registers
differently if we detect a nixpkgs groff. this also means we can use
plain `.Os` without hard-coding the os as detected by mandoc.
@pennae
Copy link
Contributor Author

pennae commented Feb 4, 2023

we thought that mandoc inspects /etc/os-release or something like that, but it looks like the os it uses is just built into the package too: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/misc/mandoc/default.nix#L27

not sure what to do with that knowledge to be honest. groff was explicitly set to Nixpkgs because nixos is just one user of nixpkgs, mandoc went the other way.

@alyssais
Copy link
Member

alyssais commented Feb 4, 2023

not sure what to do with that knowledge to be honest. groff was explicitly set to Nixpkgs because nixos is just one user of nixpkgs, mandoc went the other way.

@sternenseemann can we make mandoc say "Nixpkgs" too? (In the general case — these pages should still say "NixOS" ideally since they're for the NixOS tools.) (The person who originally set that doesn't seem to be active any more.)

@sternenseemann
Copy link
Member

I'd be fine with that, sure.

@pennae
Copy link
Contributor Author

pennae commented Feb 19, 2023

if mdoc is changed to use OS=NixOS, how much of this PR would remain? sounds like we could (should?) drop it entirely.

@sternenseemann
Copy link
Member

You mean Nixpkgs?

@pennae
Copy link
Contributor Author

pennae commented Feb 19, 2023

eh, yes. 🤦

@sternenseemann
Copy link
Member

I'd say so! I'd also drop all the shenanigans from the mdoc files and just use the default OS.

If we are too bothered by it I'd make "nixos-versions" of mandoc and groff that are injected into the man viewers via the man-db/mandoc nixos modules (since we can't change it globally via a config file?).

sternenseemann added a commit to sternenseemann/nixpkgs that referenced this pull request Feb 22, 2023
sternenseemann added a commit that referenced this pull request Feb 23, 2023
@pennae
Copy link
Contributor Author

pennae commented Feb 23, 2023

superseded by #217705

@pennae pennae closed this Feb 23, 2023
@pennae pennae deleted the nixos-manpages-os-spec branch March 4, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants