Skip to content

dovecot: read dovecot version into nix variable

Ruben Maher requested to merge eqyiel:detect-dovecot-version into dovecot23

This adds a file dovecot-version.nix which is a derivation that produces a JSON blob like this:

❯ nix-build --expr 'with import <nixpkgs> {}; callPackage ./mail-server/dovecot-version.nix {}' && cat result
/nix/store/8srvh6d7d7c4n9jj83jz3fpdn0na4986-dovecot-version
{
  "major": 2,
  "minor": 3,
  "patch": 0
}

It can be used like this to check the current dovecot version:

nix-repl> builtins.fromJSON (builtins.readFile (pkgs.callPackage ./dovecot-version.nix {}))
{ major = 2; minor = 2; patch = 33; }

Merge request reports