Nixpkgs-update-notifier: subscribe to nixpkgs-update build errors

Hey everyone, inspired by @maralorn’s excellent bot, I’ve been working on a similar tool, that would allow me to subscribe to build failures of the nixpkgs-update tool.

You can find the bot at @nixpkgs-update-notify-bot:matrix.org (link), and the repo over here.

It periodicallyatm every 1hr fetches logs from https://github.com/nix-community/nixpkgs-update, notifying subscribers of any failure. It doesn’t have access to the builder’s exit code, so it has to resort to some dumb regex matching on the logs. I think if this proves to be useful, it could be cool to integrate it into the nixpkgs-update infrastructure, so it wouldn’t have to do that (and could develop other capabilities, e.g. a last_success command)

Please let me knowhere or by filing an issue if you encounter any problems.


UPDATE: The bot does not currently handle E2EE messaging (didn’t seem useful for such a bot), so if you send it encrypted messages it will not answer. This means the bot currently doesn’t work if you message it from Element X, whereas it does from Element.

UPDATE2: Current workaround is to add the bot to a public, unencrypted room.

17 Likes

I might be missing something obvious; is there a public instance of the bot anywhere currently, or is it in a “host-it-yourself” state?

1 Like

Oops sorry, forgot to post the link to the bot.

Fixed in the OP – thanks :slight_smile:

1 Like

i would love the option for per-maintainer rss feeds, or a static report of all packages whose most recent attempt was a failure, kinda like nix-review-tools does for hydra

5 Likes

This, or being able to subscribe to multiple packages in a single message, would be really nice. As it is, I’d have to send a lot of messages to subscribe to all the packages I maintain

3 Likes

you can list the packages of a maintainer like so:

curl 'https://releases.nixos.org/nixos/unstable/nixos-24.11pre684053.9357f4f23713/packages.json.br' | brotli -dc  | jq '.packages|to_entries[]|select(.value.meta.maintainers[]?|.github|index("pbsds"))|.key'

package.json can be made using

nix-env --extra-experimental-features no-url-literals --option system x86_64-linux -f ./. -qaP --json --meta  --no-allow-import-from-derivation > packages.json
3 Likes

Could you add a subscription to packages by regex?

My use case is that I want to be notified if one of vimPlugins.* will fail (I like to maintain them, but I don’t want to explicitly specify myself as a maintainer of 3000+ packages)

Anyway, great work!

1 Like

Some way of subscribing to multiple packages at once is definitely planned, but I’m not sure about the regex approach.

The main reason is that, exactly as you bring up, people could subsribe to thousands of packages (potentially all packages nixpkgs-update knows about, ~56000), which would put a lot of stress on the nix-community.org server.

There’s also the issue of accepting untrusted regexes, and I’d have to make sure there are not vulnerabilities there.

All in all, I’m much more likely to implement a hard-coded way of subscribing to e.g. the same package under multiple Python versions, than something like all vim plugins – sorry!

1 Like

Then, would it be possible to implement a way to subscribe to a package set? You can check if a package set is too big (e.g. python312Packages)

The same as it is implemented on search.nixos.org:
image

I just deployed a new version which adds support for wildcards, in the form of globs (i.e. * and ?).

This should hopefully satisfy your feature request, @perchun :slight_smile:

So you can now do:

  • sub python*Packages.acme
  • sub python31?Packages.acme
  • sub *.acme
  • unsub *

You can’t do things like sub *, because that would put an unreasonable strain on the nix-community server hosting the logs. Please let me know if I’ve forgotten to block anything that should be blocked, thanks.

Next up is maintainer-based subscriptions.

4 Likes

That works, thanks!

Though if I subscribed to python3*Packages.something, and then 3.14 got released, it won’t subscribe to python314Packages.something automatically, right?

image

And it didn’t pick up python313Packages.inject (and not only inject) for some reason, but it gets built by hydra

Correct, you’d have to re-run sub python3*Packages.inject. When you run that query, it gets resolved to the actual packages, and the subscription is added to those. There’s no notion of subscribing to globs, at the moment.

It’s never been built by nixpkgs-update though. You can see that because it’s missing from here.


EDIT: actually, no 3.13 packages have been built by nixpkgs-update at all. I’m not immersed in the Python subsystem so can’t tell you why, but I’m sure there’s a Good Reason™.

2 Likes

OK, I’ve just deployed a version that implements a new command, follow, which lets users subscribe to all packages maintained by a given Nixpkgs maintainer.

Note that:

  • The handle you pass to the command must be your github one
  • You can only subscribe to packages built by nixpkgs-update, which are a subset of the ones in Nixpkgs.
  • The corresponding unfollow command is still being worked on Done.

It’s currently a bit slow because it fetches logs synchronously, if there’s interest I might work on making it async.

/cc @pbsds @fgaz, this hopefully goes in the direction of what you were asking for (although it’s not an RSS feed, might work on that next).

Let me know your thoughts!

4 Likes

OK, unfollow was deployed as well. Let me know if there are any issues.

1 Like

I tried to follow emily. I seem to now be subscribed to packages maintained by emilylange and emilytrau, but not the packages I maintain.

1 Like

For me, follow PerchunPak (my gh) and follow perchun (my entry in maintainers-list.nix) error with There was a problem processing your request, sorry.

Yeah, I’m working on a fix. Basically, the way I was doing it before (using the query by @pbsds from this post) can be used for DOS’ing by using extremely general queries, e.g. follow a. This is due to its use of the index jq function, which would match any maintainer whose GitHub handle contains the letter a.

Relatedly, the use of index makes it impossible to distinguish between (hypothethical users) foo, foobar and barfoo. A query like follow foo would match all of them.

The solution is to use a function that works on regexes, like test, which I’m trying to do here using the gojq library, but for some reason, it errors with:

"test(\"^asymmetric$\"; null) cannot be applied to: null"  

The same query works on both jq and CLI gojq, so I’m not really sure what’s up. Would appreciate any help!

Therefore, for the time being, the follow command is functionally disabled (i.e. it returns the error you’ve seen), cause I’d like to avoid getting bombed (by accident or not) with 1000s of subscriptions.


EDIT: In fact, it does not work in jq either (it did on my test data):

curl -sL https://channels.nixos.org/nixos-unstable/packages.json.br | brotli -dc | jq '.packages|to_entries[]|select(.value.meta.maintainers[]?|.github|test("^asymmetric$"))|.key'
jq: error (at <stdin>:1): null (null) cannot be matched, as it is not a string

The error is because curl -sL https://channels.nixos.org/nixos-unstable/packages.json.br | brotli -dc | jq '.packages|to_entries[]|.value.meta.maintainers[]?|.github' returns multiple nulls

Solution to this would be jq '.packages|to_entries[]|select(.value.meta.maintainers[]?|.github|walk(if type == "null" then "" else . end)|test("^asymmetric$"))|.key' (I added walk(if type == "null" then "" else . end))

1 Like

Thanks a lot for the pointer! I ended up simplifying your query slightly, and now it’s deployed – should be working as expected now, hopefully :slight_smile:

/cc @emily feel free to try again (this time, using your github handle). There should be no more confusion between the different emilys :smiley: