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