nixos-mailserver/mail-server/dovecot-version.nix
Ruben Maher 5b570ad5a0 dovecot: read dovecot version into nix variable
This allows determining whether it's OK to use particular configuration
variables that will throw errors when used in older versions.
2018-02-17 22:24:39 +10:30

13 lines
399 B
Nix

{ dovecot, gawk, gnused, jq, runCommand }:
runCommand "dovecot-version" {
buildInputs = [dovecot gnused jq];
} ''
jq -n \
--arg dovecot_version "$(dovecot --version |
sed 's/\([0-9.]*\).*/\1/' |
awk -F '.' '{ print $1"."$2"."$3 }')" \
'[$dovecot_version | split("."), ["major", "minor", "patch"]]
| transpose | map( { (.[1]): .[0] | tonumber }) | add' > $out
''