Add narinfo URL rewrite modes#26
Merged
Merged
Conversation
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ibc3ec4a92b7ee88a2a955e62ee0e842b6a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic8b02b73623e8edd665a5bb8000c33aa6a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If29da541ab3aa4bd5d22b5f09e0b0d166a6a6964
atagen
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I was thinking maybe we'd implement more "transparent" proxying capabilities in the same line as selector4nix, another project in the same domain that caught my eye.
Consequently ncro now supports a per-upstream
nar_url_modesetting. The defaultkeepmode preserves existing behavior.to_selfrewrites the narinfoURL:value to a relative path so NAR downloads are routed back through NCRO.to_upstreamrewrites the value to an absolute URL rooted at the selected upstream. Rewriting happens only after the upstream narinfo has been fetched, parsed, filtered, and signature-verified, so verification still happens against the upstream’s original signed content. The route database continues to store the original upstream URL path for stable NAR lookup. tl;dr: This PR adds:URL:rewrite modesAlso for nerds, router-side upstream setup is now routed through a
RouterUpstreamabstraction andRouter::register_upstream(...). This hopefully avoids continuing to grow one-off startup setters for every new upstream attribute, and keeps future upstream-level features easier to add without duplicating wiring in the CLI. Will I use it? Probably not. Do I like it? Yes.Also credit where credit is due. This PR was inspired by the substituter-proxying ideas around per-substituter behavior and narinfo URL routing of https://github.com/StarryReverie/selector4nix.