Skip to content

Add narinfo URL rewrite modes#26

Merged
NotAShelf merged 3 commits into
mainfrom
notashelf/push-nrozxoswtxwl
Jun 9, 2026
Merged

Add narinfo URL rewrite modes#26
NotAShelf merged 3 commits into
mainfrom
notashelf/push-nrozxoswtxwl

Conversation

@NotAShelf

Copy link
Copy Markdown
Member

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_mode setting. The default keep mode preserves existing behavior. to_self rewrites the narinfo URL: value to a relative path so NAR downloads are routed back through NCRO. to_upstream rewrites 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:

  • Add per-upstream timeout overrides for narinfo requests and NAR streaming
  • Add configurable narinfo URL: rewrite modes

Also for nerds, router-side upstream setup is now routed through a RouterUpstream abstraction and Router::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.

NotAShelf added 2 commits June 8, 2026 21:53
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ibc3ec4a92b7ee88a2a955e62ee0e842b6a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic8b02b73623e8edd665a5bb8000c33aa6a6a6964
@NotAShelf NotAShelf marked this pull request as ready for review June 9, 2026 05:32
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: If29da541ab3aa4bd5d22b5f09e0b0d166a6a6964
@NotAShelf NotAShelf merged commit b33e432 into main Jun 9, 2026
9 checks passed
@NotAShelf NotAShelf deleted the notashelf/push-nrozxoswtxwl branch June 9, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants