Implement local link checking as part of build #487
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was #483, addresses part of #481.
Now with preview ;)
This was a bit more involved than initially anticipated. I don't think it's feasible to test local files without a webserver, as the file path semantics are different. There were a bunch of false negatives, as linkchecker simply ignored paths like
/nixpkgs
as they are outside the domain – and they would not work, as they translate tofile:///nixpkgs
.Starting a local webserver is a heavier approach, but solves the issue. Here I chose caddy instead of, say,
python -m http.server
, because it is quite a bit faster, yet still zero-configuration for this use case. (I also considered lighttpd and busybox httpd, both of which had unsuitable default configurations.)The
/pkgs/...
routes from the nixpkgs manual are ignored, because I think this issue should likely be solved upstream. Even without checking the nixpkgs manual, this setup provides significant value to guard against dead link regressions.An end-to-end link check against deployed https://nixos.org is out of scope for this PR.