Notification on update when channel advances

I’m just wondering if there is a way to get some kind of notification when specific packages are available in a newer version because a channel has advanced.

E.g. I am interested in the availability of newer versions emacs than the one I have installed so I would like to be notified when a newer version of the emacs package is available in any channel

Maybe it would be useful in general to have a list of package version changes between two states of a channel or two channels in general.

Iirc nix-env --upgrade prints some kind of version comparison when running. Is this something which is available with broader applicability that could be used for that?

3 Likes

For packages installed with nix-env -i (which I assume you’re talking about as you mentioned nix-env --upgrade), you can use nix-env -qc to compare your installed packages with what’s available in your configured channel (channels? Not sure how it handles multiple channels). It doesn’t respect meta.priority so you’ll end up with it telling you that e.g. nodejs-8.15.1 can be upgraded to 11.13.0 even though nix-env -u won’t do that, but for most packages it reports what you’ll get with a nix-env -u.

1 Like

Oh cool I didn’t know the -qc flag. But I am actually more interested in globally installed packages and information like “OMG mu just advanced to 1.2 in the unstable channel you could consider pulling that package from unstable for those hot new features”.

1 Like

Unfortunately I don’t know of any way to do the equivalent of nix-env -qc on system packages.

The simplest solution would probably be to write a shell expression like that (note I’ve just scribbled that down and it is as ugly as it gets, but good enough to convey the general idea)

with import <nixpkgs> {};
let
  current =  import /nixpkgs {};
  upstream = import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) {};
in pkgs.stdenv.mkDerivation {
  name = "CheckForUpdates";
  version = "0.1";

  # yep nix can compare strings
  shellHook = if current.pkgs.mu.version < upstream.pkgs.mu.version then ''
    ${pkgs.libnotify}/bin/notify-send "mu can be updated to version ${upstream.pkgs.mu.version}" && exit
  '' else ''exit'';
}

/nixpkgs is in that case your current nix channel. Just set up a systemd timer to run your shell script regularly and you are good to go.

2 Likes

a bit sideways but looking at https://www.reddit.com/r/vim/comments/be48lw/meainvimpackagejson_plugin_to_show_npm_package/ reminded me of this topic: woud be cool to see if master contains another version while editing a package :slight_smile:

1 Like

I was working on - but never quite finished - an RSS feed generator for channel updates. I’ll try to get that working over the Easter holiday

7 Likes

Any update on this? I’m interested :slight_smile:

You can track channel advances by following the feed of commits on the corresponding Git branch: https://github.com/NixOS/nixpkgs/commits/nixos-unstable.atom. You can approximate package updates by tracking a commits in a single file/directory: https://github.com/NixOS/nixpkgs/commits/nixos-unstable/pkgs/applications/editors/emacs.atom

4 Likes

Very nice, thanks !!!

And perfectly integrated in Thunderbird !

image

Having Github commits was not enough, so I created a RSS feed based on the data from Prometheus, find it here:

https://nixos-channels-feeds.herokuapp.com/api/channels

You can also access data per channel:

https://nixos-channels-feeds.herokuapp.com/api/channel/nixos-21.05

Hope it will be useful :wink:

4 Likes

I will disable that RSS feed soon, I discovered that subscribing to the Github RSS feeds was much more efficient because once it’s updated, it means that your computer is ready to be updated, that was not the case with my own RSS feeds based on another source.