dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.72k stars 1.02k forks source link

Nix flake support #7340

Open yajo opened 1 year ago

yajo commented 1 year ago

Is there an existing issue for this?

Feature description

Nix is becoming, little by little, the only dependency management tool I'm using. It covers every possible case in the best possible way.

Modern nix is based on flakes, which is currently experimental, but is already quite stable. Read here about them please.

Did you read that? OK.

As you've seen, there are 2 things that could be auto-updated when using flakes:

1️⃣ flake.lock file. Reproduce a single input upgrade with:

git clone https://github.com/copier-org/copier
cd copier
git checkout f722b9acf5d7e21f35d410e015f4ae6f36587e4a
nix flake lock --update-input poetry2nix
git diff

You'll see that command updated only a single input from the flake lock file.

2️⃣ some inputs inside the flake.nix file. Usually flake users refer to the main branch on the input, but they can refer to a tag. If so, it'd be also helpful for dependabot to support those kind of updates.

For example, updating an input like this would result in:

-    devenv.url = "github:cachix/devenv/v0.5";
+    devenv.url = "github:cachix/devenv/v0.6.2";

... together with the corresponding lock file update, which would be done running nix flake lock.

drupol commented 1 year ago

I'm also looking for this feature.

hschaeidt commented 1 year ago

renovate has nix support

https://docs.renovatebot.com/modules/manager/nix/

drupol commented 1 year ago

Renovate doesn't fully support it since it cannot be triggered when the flake.nix file contains custom inputs (not from nix)... so it's totally useless.

Example: https://github.com/loophp/php-src-nix/pull/14

KiaraGrouwstra commented 8 months ago

an alternate approach could be to use nix flake update such as to grab updates within the flake input's specified branch, as suggested at https://github.com/NixOS/nix/issues/9823

KiaraGrouwstra commented 8 months ago

i think the OP's approach seems like a straightforward port of dependabot logic to the nix context, but it feels weird with flakes that way, essentially moving the lock file responsibility from flake.lock to flake.nix, raising questions as to how one might then express flake.nix's present functionality to specify what branch to follow or revision to lock to.

even under an approach based on nix flake update as suggested in the linked thread tho, one might imagine variants doing a general update versus updating single flake inputs at a time. the latter there seems maybe more like how dependabot has functioned so far.

now, a nix flake update approach would move updates from the release level to the commit level, which would be a somewhat dramatic departure from how dependabot has functioned so far, raising questions both about update robustness as well as about a potentially exploding number of automated pull requests.

i imagine dependabot may have settings to curb the last problem.

i feel like i had seen a project to allow flake updates to stick to releases, but i don't really remember.

KiaraGrouwstra commented 8 months ago

reading the renovate module, they:

going over dependabot's instructions for adding a package manager conceptually for nix flakes:

JohnRTitor commented 5 months ago

Found this issue, would love to have this feature!

peterbecich commented 4 months ago

Can some effort be saved by integrating this GitHub Action with the Dependabot? https://github.com/DeterminateSystems/update-flake-lock

luisnquin commented 4 months ago

I support this

sebastien commented 3 months ago

Support this as well

noverby commented 3 months ago

@JohnRTitor @luisnquin @sebastien You don't have to comment to support this feature. Just with an upvote, you can show support. :) When you comment, you trigger notifications to everyone subscribed to the issue.

JohnRTitor commented 3 months ago

I kind of see your point. But upvoting is very silent on GitHub.

Commenting on an issue sends a notification, and could serve as a reminder for those who wanted to work on it at some point and then forgot.

A long discussion on a GitHub issue itself means the issue is pretty relevant and looking for attention.

sebastien commented 3 months ago

Ok so happy to make a case: Nix usage is increasing, and overall offers a wide coverage that includes not only language-specific packages, but also the underlying native libraries which are often themselves the root cause of vulnerabilities. As a result, supporting Nix lockfiles helps Dependabot better achieve its goal of flagging vulnerabilities across a wider range of languages.