Skip to content

doc: fix nixpkgs-manual not being built under index.html #400816

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

nezia1
Copy link
Member

@nezia1 nezia1 commented Apr 22, 2025

This fixes the anchor links referencing index.html while being in manual.html.

The derivation is just not functional in it's current state, as it is currently being moved under manual.html, which breaks every anchor link. Closes #400785.

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 the 8.has: documentation This PR adds or changes documentation label Apr 22, 2025
@nezia1
Copy link
Member Author

nezia1 commented Apr 22, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 400816


x86_64-linux

✅ 1 package built:
  • nixpkgs-manual

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 22, 2025
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

I fail to understand how this is fixing the original issue, care to elaborate a bit more?

@nezia1
Copy link
Member Author

nezia1 commented Apr 23, 2025

I fail to understand how this is fixing the original issue, care to elaborate a bit more?

So this derivation, in its current state, will not work, as it is generated with nixos-render-docs with the index.html final positional argument, which generates the HTML under index.html. This also makes the inner anchor links generate under index.html.

If you pass in manual.html to nixos-render-docs, you get an error, as doc/redirects.json have not been updated yet with manual.html (they still reference index.html), so the builder fails with:

       >     If you moved content, add its new location as the first element of the redirects mapping.
       >     Please update doc/redirects.json or nixos/doc/manual/redirects.json!

The solution that was found to this "problem" was to move index.html to manual.html after generating it, which obviously breaks the derivation because this does not update the inner anchor links, who still reference index.html.

We have two options here (I went with 1):

  1. Keep the manual generation under index.html
  2. Generate the manual under manual.html, and also update doc/redirects.json

Considering nixpkgs-manual is meant to either be hosted on a server or accessed locally, I think it makes sense to keep it under index.html as it's a single page website.

@drupol
Copy link
Contributor

drupol commented Apr 23, 2025

But why would one use manual.html? What are the reason(s) we use it?

@nezia1
Copy link
Member Author

nezia1 commented Apr 23, 2025

After looking at the blames for doc/doc-support/package.nix, I think I understand it more now.

This is where it originally was, and actually used common.indexPath for the move location. What should have been done from the beginning is generate the documentation directly under common.indexPath instead of moving the file, as that would take care of the anchor links. In essence, the manual would never work if one were to move the html file as that will break the anchors.

It was then hard coded in, in this specific commit.

@philiptaron any reason why you decided to rename the manual html file? I'm trying to understand the motivation behind it.

@nezia1
Copy link
Member Author

nezia1 commented Apr 23, 2025

Nevermind, I read those commits wrong. It seems like it was always manual.html to begin with, and the derivation was just not generated there, causing the issues. This is what common.indexPath used to be set to.

The question would be now, do we want it named manual.html? I can't find where this specific derivation is being used within nixpkgs, so I'd assume naming it index.html wouldn't change a lot..?

EDIT: The redirects.json still mention index.html in master (and have been for a while), so that leads me to believe manual.html was never supposed to be.

@philiptaron
Copy link
Contributor

Yeah, I tried to keep everything the same. redirects.json came about after my changes to refactor the derivation(s) so I don't know why they use index.html.

I do buy this change. I note that the production site manual.html is nowhere to be seen and index.html rules the day.

@fricklerhandwerk / @NixOS/documentation-team do you all have any idea about how this derivation makes it way to that site?

philiptaron
philiptaron previously approved these changes May 17, 2025
@philiptaron
Copy link
Contributor

I plan on merging this and seeing what the fallout is. I expect there to be nothing.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 17, 2025
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.

Let's just change mv to cp. Not doing a backward compatible change will break building the manual on nixos.org (see https://github.com/NixOS/nixos-homepage/blob/main/flake.nix), or at least require intervention by maintainers and an extra conditional to check for that file's existence that will have to stay around for at least a release.

@philiptaron philiptaron dismissed their stale review May 18, 2025 14:55

I'll follow Valentin's lead.

@nezia1 nezia1 force-pushed the fix-nixpkgs-manual-path branch 2 times, most recently from 08b1a27 to 6d918cb Compare May 20, 2025 06:49
@nezia1
Copy link
Member Author

nezia1 commented May 20, 2025

We should be good now. Let me know if I missed anything.

@nezia1 nezia1 force-pushed the fix-nixpkgs-manual-path branch from 6d918cb to 2eea2f8 Compare May 20, 2025 06:50
@nezia1 nezia1 force-pushed the fix-nixpkgs-manual-path branch from 2eea2f8 to dd8ca0f Compare May 20, 2025 10:37
This fixes the anchor links referencing `index.html` while being in
`manual.html`.
@nezia1 nezia1 force-pushed the fix-nixpkgs-manual-path branch from dd8ca0f to 266a077 Compare May 20, 2025 10:38
@nezia1
Copy link
Member Author

nezia1 commented May 20, 2025

Done. Please keep in mind that since we copied index.html to manual.html, the references to the anchor links will not reference the same file and will trigger a page reload when using the latter.

@fricklerhandwerk fricklerhandwerk merged commit b5bd640 into NixOS:master May 20, 2025
26 of 29 checks passed
@fricklerhandwerk
Copy link
Contributor

Thanks for your patience, everyone :)

@nezia1 nezia1 deleted the fix-nixpkgs-manual-path branch May 20, 2025 12:13
Dev380 pushed a commit to Dev380/nixpkgs that referenced this pull request May 22, 2025
)

This fixes the anchor links referencing `index.html` while being in `manual.html`.
Sh3Rm4n pushed a commit to Sh3Rm4n/nixpkgs that referenced this pull request Jul 27, 2025
)

This fixes the anchor links referencing `index.html` while being in `manual.html`.
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: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nixpkgs-manual: anchor links reference the wrong file
5 participants