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?

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

3 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

8 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

This gives a feed entry for every single commit to the branch, not just when the branch pointer updates (i.e. when you can update your system).

Does anyone know a way to track when updates become available? status.nixos.org is great, but an RSS/Atom feed would be nice, so I don’t have to repeatedly check that site. It seems like it’d be really useful to have a feed of status from hydra?

The commits will only appear when the branch pointer updates, though. That is the whole point of the channel branches.

Sorry, my phrasing wasn’t the best there. I was hoping to find a single entry per branch update, but this gives tons of feed updates when the branch changes, kind of overwhelming my feed reader.