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?



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.



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”.



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> {};
  current =  import /nixpkgs {};
  upstream = import (fetchTarball {};
in pkgs.stdenv.mkDerivation {
  name = "CheckForUpdates";
  version = "0.1";

  # yep nix can compare strings
  shellHook = if < then ''
    ${pkgs.libnotify}/bin/notify-send "mu can be updated to 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.



a bit sideways but looking at reminded me of this topic: woud be cool to see if master contains another version while editing a package :slight_smile:



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