-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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-render-docs: init redirects system #353513
Conversation
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.js
Outdated
Show resolved
Hide resolved
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
path, anchor = location.split('#') | ||
if path != redirection_target: | ||
continue | ||
client_redirects[anchor] = f"{locations[0]}#{identifier}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for later: compute the relative path between redirection_target
(maybe a better name: from
?) and locations[0]
. otherwise all of this will fall apart once we have files inside different directories
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/splitting-the-nixpkgs-and-nixos-manual-into-pages/55466/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good architecturally. Tests and build still fail though.
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
Do we have any options to not commit a 70k lines json? 😅 |
It seems like the content is trivial too. |
@GetPsyched Thank you so much for doing this. Once the pages are split i would like to integrate pagefind. This should be straight forward. |
I don't love that we're adding huge files when nixpkgs size is a growing concern; this is why a lot of effort went into making sure we have the most minimum diff. We're compelled to storing all identifiers as its static data we cannot infer in the NRD's build process itself. One way to do it would be to check the base/parent commit, but that has its own issues; some that I can remember off the top of my head:
An alternative that was considered was storing each identifier as a file instead of a key in a JSON. We chose not to go that route as it would lead to having 20,000+ files as of 24.05. |
Awesome! I've heard good things about pagefind and wanted to try it out myself at some point. IIRC it works off of the rendered HTML, right? This should fit quite well with the manuals. I'll get to the XML bit once a few key things are checked off our todo; will ping you on the documentation Matrix room :D |
71ab85a
to
01f9fc7
Compare
I want to look into those details more closely. I am concerned about the size of the File. And huge diffs cluttering git. Please give me some time i ll do it then next days and provide alternatives If i find any |
That is what i would suggest. I guess once the pages are split out the new automatic library and option docs will follow a certain schema. Assuming that lib functions and options are stable. This will also yield stable redirects. For breaking changes of the underlying references (lib, options) i would suggest that we introduce another kind of index for documentation that tracks lib functions that have been deprecated alongside with the reason and some other stuff. (Another PR, feature later) The deprecation index for options should be possible to build from the options themselves somehow. But i would need to look into that details (option tree) a bit further. (Another PR, feature later) |
b4ff044
to
c1380aa
Compare
pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/redirects.py
Outdated
Show resolved
Hide resolved
@hsjobeki we're down to ~6400LOC for tracking redirects on hand-written content. Any objections to merging? |
Seems as low as it may get for now. I am okay with merging as it is. Could you add me as codeowner as well? So i get notified if anyone starts actively changing/adding redirects. Also i feel like we are missing some documentation how to test a redirect after adding it. (nixos/nixpkgs manual) |
Can you elaborate on this? What would we write for such a document? (are we explaining how redirects work or how NRD implements them?) |
Something like: For server-side redirects (once we have them) you'd need to run |
NixOS and Nixpkgs manual CI is failing due to a lack of a rebase. I will do it once the changes have been reviewed. |
This was unintentionally broken in 571c71e
Co-authored-by: Valentin Gagarin <[email protected]>
533754e
to
4285cd5
Compare
I think we need to backport this PR since branch-off happened yesterday. |
Successfully created backport PR for |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/breaking-changes-announcement-for-unstable/17574/69 |
I find these `mkProvider` and `mkRequester` functions really nice. Also fixes doc generation related to NixOS/nixpkgs#353513
An implementation of a redirects system to keep track of changes in the documentation such that old links don't break. Such a system will enable free movement of pages in the future without fear of breaking links; while also allowing us to catch old breakages retrospectively -- in a follow-up PR :D
PS: Commits will be squashed once the PR is marked for review.