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.
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
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
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)
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!
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.
Though if I subscribed to python3*Packages.something, and then 3.14 got released, it won’t subscribe to python314Packages.something automatically, right?
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™.
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).
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))