From 6316ae4c30ec956a32ad8e5b588fbfceabb6f76f Mon Sep 17 00:00:00 2001 From: magicquark <198001825+magicquark@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:56:42 +0000 Subject: [PATCH] dovecot: add mysql-config dependency Required when using `withMySQL` with `strictDeps` set to true. --- pkgs/by-name/do/dovecot/generic.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/do/dovecot/generic.nix b/pkgs/by-name/do/dovecot/generic.nix index 7c6c2768f505..40326745401c 100644 --- a/pkgs/by-name/do/dovecot/generic.nix +++ b/pkgs/by-name/do/dovecot/generic.nix @@ -7,6 +7,7 @@ autoreconfHook, stdenv, lib, + buildPackages, fetchzip, flex, bison, @@ -54,7 +55,20 @@ withLua ? false, lua5_3, }: - +let + # The `nativeBuildInputs` version of `mysql_config` emits headers and libraries for + # the build platform, not the host platform; `pkg-config` emits the correct versions. + fake_mysql_config = buildPackages.writeShellScriptBin "mysql_config" '' + if [ "$1" == "--include" ]; then + "$PKG_CONFIG" --cflags mysqlclient + elif [ "$1" == "--libs" ]; then + "$PKG_CONFIG" --libs mysqlclient + else + echo "fake_mysql_config: unsupported option: $1" >&2 + exit 1 + fi + ''; +in stdenv.mkDerivation (finalAttrs: { pname = "dovecot"; inherit version; @@ -66,7 +80,8 @@ stdenv.mkDerivation (finalAttrs: { pkg-config ] ++ lib.optionals (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ autoreconfHook ]; + ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ autoreconfHook ] + ++ lib.optional (withMySQL && lib.versionOlder version "2.4") fake_mysql_config; buildInputs = [ openssl