Skip to content

Add an exact flake registry override for nixpkgs#465

Open
grahamc wants to merge 3 commits into
mainfrom
grahamc-patch-1
Open

Add an exact flake registry override for nixpkgs#465
grahamc wants to merge 3 commits into
mainfrom
grahamc-patch-1

Conversation

@grahamc
Copy link
Copy Markdown
Member

@grahamc grahamc commented May 21, 2026

Never see this again:

image

Users of CI platforms that aren't GitHub Actions frequently see rate-limiting errors while fetching Nixpkgs.

This is because GitHub aggressively rate-limits tarball downloads for requests without a GitHub Token. In GitHub Actions, this is largely solved by providing a token in the nix.conf.

This change causes nixpkgs and therefore nix run nixpkgs#... commands to fetch Nixpkgs from FlakeHub, making this work out of the box across the board.

Note that users are encouraged to avoid using the flake registry for flake inputs: #37

Motivation

Context

Summary by CodeRabbit

  • Chores

  • Tests

    • Updated regression expectations to reflect the new tarball-based fallback resolution.

Review Change Stack

Users of CI platforms that aren't GitHub Actions frequently see rate-limiting errors while fetching Nixpkgs.

This is because GitHub aggressively rate-limits tarball downloads for requests without a GitHub Token.
In GitHub Actions, this is largely solved by providing a token in the nix.conf.

This change causes nixpkgs and therefore `nix run nixpkgs#...` commands to fetch Nixpkgs from FlakeHub, making this work out of the box across the board.

Note that users are encouraged to avoid using the flake registry for flake inputs: #37
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

📝 Walkthrough

Walkthrough

The nixpkgs builtin flake registry entry is changed from a GitHub ref to an exact FlakeHub tarball URL (https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1), and the functional test expectation is updated to match.

Changes

Builtin Flake Registry Update

Layer / File(s) Summary
Nixpkgs FlakeHub migration
src/libfetchers/builtin-flake-registry.json
nixpkgs registry target replaced: previously a GitHub mapping pinned to ref: "nixpkgs-unstable", now an exact tarball with to.type: "tarball" and to.url: "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1".
Fallback resolution test update
tests/functional/flakes/flakes.sh
Test expectation updated to assert the builtin fallback resolution for nixpkgs returns the FlakeHub tarball URL instead of the prior github:NixOS/nixpkgs/nixpkgs-unstable flakeref.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I’m a rabbit with a flake in paw,
Swapping GitHub for a tarball law,
Nixpkgs now hops to a steady URL,
Tests updated, all is well. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding an exact flake registry override for nixpkgs, which switches from GitHub to a FlakeHub tarball target.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch grahamc-patch-1

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/libfetchers/builtin-flake-registry.json (1)

334-356: ⚡ Quick win

Confirm exact precedence: bare nixpkgs will match the FlakeHub entry; qualified refs will use the GitHub fallback.

lookupInRegistries treats "exact": true as entry.from == input, and otherwise uses entry.from.contains(input) (with a restart on first match). With both entries sharing the same from, a bare nixpkgs input should hit the exact-equality FlakeHub mapping, while qualified refs (e.g., nixpkgs/nixos-23.11) won’t be equal to the bare from and should fall through to the non-exact contains mapping to GitHub.
Consider adding a brief comment/documentation explaining why the registry intentionally contains two nixpkgs entries.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/libfetchers/builtin-flake-registry.json` around lines 334 - 356, Add a
brief explanatory comment in builtin-flake-registry.json adjacent to the two
entries that share "from": {"id":"nixpkgs"} clarifying that lookupInRegistries
treats entries with "exact": true as entry.from == input (so a bare "nixpkgs"
will match the FlakeHub tarball entry) and that the second, non-exact/github
entry exists as a fallback for qualified refs (e.g., "nixpkgs/nixos-23.11")
because those will not equal the bare from and will match via contains/restart;
also ensure the exact-true FlakeHub entry appears before the non-exact GitHub
entry to preserve precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/libfetchers/builtin-flake-registry.json`:
- Around line 334-356: Add a brief explanatory comment in
builtin-flake-registry.json adjacent to the two entries that share "from":
{"id":"nixpkgs"} clarifying that lookupInRegistries treats entries with "exact":
true as entry.from == input (so a bare "nixpkgs" will match the FlakeHub tarball
entry) and that the second, non-exact/github entry exists as a fallback for
qualified refs (e.g., "nixpkgs/nixos-23.11") because those will not equal the
bare from and will match via contains/restart; also ensure the exact-true
FlakeHub entry appears before the non-exact GitHub entry to preserve precedence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 01a83314-49a1-469f-a0c3-90f076a05b29

📥 Commits

Reviewing files that changed from the base of the PR and between 0a5b634 and 4478ce3.

📒 Files selected for processing (1)
  • src/libfetchers/builtin-flake-registry.json

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/functional/flakes/flakes.sh`:
- Line 287: The test currently hardcodes the fallback URL to
https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1 which pins the
builtin registry to a stale weekly release; update the test in
tests/functional/flakes/flakes.sh so it does not hardcode "0.1"—either resolve
to a floating ref like "nixpkgs-unstable" or read the weekly version from a
configurable variable (e.g., WEEKLY_PIN or FLAKEHUB_WEEKLY_VERSION) and
document/update that variable; ensure the assertion that uses the exact string
`https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1` is replaced with
a dynamic expectation or the unstable alias, and add a short comment explaining
the upgrade cadence/process for bumping the pinned weekly if you keep pinning.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c26b089d-9444-40b6-8979-dd6cba054699

📥 Commits

Reviewing files that changed from the base of the PR and between 4478ce3 and 108fc0b.

📒 Files selected for processing (1)
  • tests/functional/flakes/flakes.sh

Comment thread tests/functional/flakes/flakes.sh
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.

1 participant