Notification on update when channel advances

#1

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?

0 Likes

#2

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.

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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.

0 Likes

#6

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:

0 Likes

#7

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

4 Likes