Add an exact flake registry override for nixpkgs#465
Conversation
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
📝 WalkthroughWalkthroughThe ChangesBuiltin Flake Registry Update
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/libfetchers/builtin-flake-registry.json (1)
334-356: ⚡ Quick winConfirm
exactprecedence: barenixpkgswill match the FlakeHub entry; qualified refs will use the GitHub fallback.
lookupInRegistriestreats"exact": trueasentry.from == input, and otherwise usesentry.from.contains(input)(with a restart on first match). With both entries sharing the samefrom, a barenixpkgsinput should hit the exact-equality FlakeHub mapping, while qualified refs (e.g.,nixpkgs/nixos-23.11) won’t be equal to the barefromand should fall through to the non-exactcontainsmapping to GitHub.
Consider adding a brief comment/documentation explaining why the registry intentionally contains twonixpkgsentries.🤖 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
📒 Files selected for processing (1)
src/libfetchers/builtin-flake-registry.json
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
tests/functional/flakes/flakes.sh
Never see this again:
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