Assert specific executable version

I have the following scenario.

I needed mu and mu4e at a newer version than stable, so I used fetchTarball:

{
  inputs,
  config,
  lib,
  pkgs,
  ...
}:
let
  unstable =
    import
      (fetchTarball {
        url = "https://github.com/NixOS/nixpkgs/archive/8f7492cc.tar.gz";
        sha256 = "033my323rmlllrb7f5as7zikas0jxgidr8ffj8gabh8q0x9mgra6";
      })
      # reuse the current configuration
      {
        config = config.nixpkgs.config;
        system = pkgs.system;
      };
in
{
  home.packages = with pkgs; [
    unstable.mu
    unstable.emacsPackages.mu4e
    isync
  ];
}

Now I want to remove the unstable as I have seen that the respective version is in stable. How would I assert that mu executable is at a version at or higher let’s say 1.12.5 ?

Where would I do that? Would I have to do that? Are there better ideas? :smiley:

Side info: I use flakes and it a lockfile. Home Manager too.

Try something like this:

(if (lib.versionAtLeast pkgs.mu.version "1.12.5") pkgs.mu else unstable.mu)

2 Likes