Npc - CLI to view and bisect Nixpkgs channel history

Hello! I built a CLI tool that lets you view all the commits various Nixpkgs channels have historically pointed to, as well as bisect within a channel to find the last time that channel pointed to a commit before something broke. It can be used by itself, but it also automatically integrates with flakes for greater convenience. I find it particularly useful if I’m using an unstable channel and something breaks after nix flake update.

I originally tried to find channel history information via the https://channels.nix.gsc.io/ website, but it seems to be no longer maintained and thus doesn’t have data more recent than a couple years ago. I was also inspired by the hydrasect tool which seems cool for bisecting inside of Nixpkgs itself (although I’ve mostly just been using --first-parent for that, which seems to work well). But I wanted to make a tool that was more targeted toward Nixpkgs consumers rather than maintainers.

I hope you find it useful!

18 Likes

That’s really nice! May I ask, how do you obtain the past releases then? From the code you seem to be querying https://nix-releases.s3.amazonaws.com/, is that correct?

1 Like

Yep! For each channel, you can get the list of all past releases via one or more prefix queries. The stable ones require only one prefix query each, whereas the unstable channels require multiple, but most of those never change so I just have their results in the Git repo. So npc fetch does those prefix queries to list all the releases, then looks up each shortened Git SHA in its local Nixpkgs clone to get the full Git SHA. If any of the SHAs happen to be ambiguous or not already in the local clone, it queries the bucket for the git-revision object under that prefix.

1 Like