豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Initial nix support#14498

Merged
JamieMagee merged 3 commits intomainfrom
nix-flakes
Mar 22, 2026
Merged

Initial nix support#14498
JamieMagee merged 3 commits intomainfrom
nix-flakes

Conversation

@JamieMagee
Copy link
Copy Markdown
Member

What are you trying to accomplish?

Add initial support for Nix flakes as a new Dependabot ecosystem, addressing #7340.

This parses flake.lock to extract flake inputs as dependencies, checks upstream git refs for newer commits, and runs nix flake update <input> to produce updated lock files. The scope is limited to lock file updates (updating pinned refs inside flake.nix itself (e.g. github:cachix/devenv/v0.5 to v0.6.2) is not included here, since that requires parsing Nix syntax).

The implementation follows the git_submodules pattern: flake inputs are SHA-pinned git dependencies with no version ordering or dependency resolution graph.

Anything you want to highlight for special attention from reviewers?

  • FileParser URL building: URLs are constructed from locked.type/owner/repo fields. We handle github, gitlab, sourcehut, and git types. We skip path, indirect, tarball, and file inputs.
  • FileUpdater shells out to nix: We can't rewrite flake.lock in Ruby because it contains narHash values that only nix can compute. The Dockerfile pulls nix from nixos/nix via multi-stage build.
  • UpdateChecker uses GitCommitChecker: Update detection is a pure git ref lookup (no nix binary needed). This keeps the check phase fast.
  • GitHub token forwarding: We don't currently pass credentials to the nix CLI. This means nix flake update will fail on private repos. Worth addressing in a follow-up.
  • Beta-gated: The FileFetcher raises unless allow_beta_ecosystems? is true, per convention for new ecosystems.

How will you know you've accomplished your goal?

  • Unit tests pass
  • Rubocop and Sorbet pass clean.
  • bin/dry-run.rb nix <repo-with-flake> against a real repo with an outdated flake.lock produces a correct update.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@JamieMagee JamieMagee requested a review from a team as a code owner March 20, 2026 15:35
Copilot AI review requested due to automatic review settings March 20, 2026 15:35

This comment was marked as outdated.

@JamieMagee JamieMagee force-pushed the nix-flakes branch 2 times, most recently from e0cb708 to ca1da00 Compare March 20, 2026 19:18
kbukum1
kbukum1 previously approved these changes Mar 20, 2026
@kbukum1 kbukum1 self-requested a review March 21, 2026 02:06
JamieMagee and others added 3 commits March 22, 2026 12:34
The base class PackageLatestVersionFinder already handles
cooldown filtering, ignored version filtering, and fallback
behavior. Remove the redundant in_cooldown_period?,
cooldown_days, and cooldown_enabled? overrides along with
five unused requires.
Implement package_details so the parent class's available_versions,
latest_version, latest_tag, etc. all work instead of returning nil.

Remove the custom latest_tag override and version_list method that
bypassed the parent pipeline (skipping yanked, unsupported, and
prerelease filters). Override wants_prerelease? to return true since
all Nix pseudo-versions have prerelease segments (0.0.0-0.N).
Copy link
Copy Markdown
Contributor

@kbukum1 kbukum1 left a comment

Choose a reason for hiding this comment

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

Nice work.

@JamieMagee JamieMagee merged commit 398be93 into main Mar 22, 2026
255 of 256 checks passed
@JamieMagee JamieMagee deleted the nix-flakes branch March 22, 2026 21:18
@JamieMagee JamieMagee mentioned this pull request Apr 7, 2026
1 task
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.

3 participants