Change:
buildInputs = [ ncurses openssl zlib pcre jemalloc libiconv <del> ] ++ stdenv.lib.optionals stdenv.isLinux [ libaio systemd ] </del> <ins> ] ++ stdenv.lib.optionals stdenv.isLinux [ libaio systemd libkrb5 ] </ins> ++ stdenv.lib.optionals stdenv.isDarwin [ perl fixDarwinDylibNames cctools CoreServices ]; prePatch = '' sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt ''; <del> patches = [ ./cmake-includedir.patch ./include-dirs-path.patch ] </del> <ins> patches = [ ./cmake-includedir.patch ] </ins> ++ stdenv.lib.optional stdenv.cc.isClang ./clang-isfinite.patch; cmakeFlags = [ "-DBUILD_CONFIG=mysql_release" "-DMANUFACTURER=NixOS.org" <del> "-DDEFAULT_CHARSET=utf8" "-DDEFAULT_COLLATION=utf8_general_ci" </del> <ins> "-DDEFAULT_CHARSET=utf8mb4" "-DDEFAULT_COLLATION=utf8mb4_unicode_ci" </ins> "-DSECURITY_HARDENED=ON" <del> "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock" </del> <ins> "-DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock" "-DINSTALL_BINDIR=bin" "-DINSTALL_DOCDIR=share/doc/mysql" "-DINSTALL_DOCREADMEDIR=share/doc/mysql" "-DINSTALL_INCLUDEDIR=include/mysql" "-DINSTALL_INFODIR=share/mysql/docs" "-DINSTALL_MANDIR=share/man" </ins> "-DINSTALL_MYSQLSHAREDIR=share/mysql" <ins> "-DINSTALL_SCRIPTDIR=bin" "-DINSTALL_SUPPORTFILESDIR=share/doc/mysql" "-DINSTALL_MYSQLTESTDIR=OFF" "-DINSTALL_SQLBENCHDIR=OFF" </ins> "-DWITH_ZLIB=system" "-DWITH_SSL=system" "-DWITH_PCRE=system" <ins> "-DWITH_SAFEMALLOC=OFF" "-DEMBEDDED_LIBRARY=OFF" ] ++ optional stdenv.isDarwin [ </ins> # On Darwin without sandbox, CMake will find the system java and attempt to build with java support, but # then it will fail during the actual build. Let's just disable the flag explicitly until someone decides <del> # to pass in java explicitly. This should have no effect on Linux. </del> <ins> # to pass in java explicitly. </ins> "-DCONNECT_WITH_JDBC=OFF" <del> # Same as above. Somehow on Darwin CMake decides that we support GSS even though we aren't provding the # library through Nix, and then breaks later on. This should have no effect on Linux. "-DPLUGIN_AUTH_GSSAPI=NO" "-DPLUGIN_AUTH_GSSAPI_CLIENT=NO" ] ++ optional stdenv.isDarwin "-DCURSES_LIBRARY=${ncurses.out}/lib/libncurses.dylib" ++ optional stdenv.hostPlatform.isMusl "-DWITHOUT_TOKUDB=1" # mariadb docs say disable this for musl ; preConfigure = '' cmakeFlags="$cmakeFlags -DINSTALL_INCLUDEDIR=''${!outputDev}/include/mysql" ''; postInstall = '' rm "$out"/lib/*.a find "''${!outputBin}/bin" -name '*test*' -delete ''; </del> <ins> "-DCURSES_LIBRARY=${ncurses.out}/lib/libncurses.dylib" ] ++ optional stdenv.hostPlatform.isMusl [ "-DWITHOUT_TOKUDB=1" # mariadb docs say disable this for musl ]; </ins> passthru.mysqlVersion = "5.7";

Discussion:
mysqlupgrade requires availability of mysqlcheck, which is in the package In other operating systems they are separated - mysqlupgrade -, mysqlcheck - And when the server is installed the client is automatically installed.
Hmm, is there a reason not to make the client a dependency of the server? The only dependencies the client has that the server doesn't are and which any server should have (via openssh). How much space is saved by removing the client binaries?
So it seems the mysql_upgrade binary is hardcoded to expect the other binaries in the same directory: Probably the splitting works on other distros because the binaries all end up in /usr/bin anyway.
Need to build the package with server+client and only client? Is this variant bad?
I'm not sure what you mean. Can you check to see if the project cmake allows you to configure a different install PREFIX for the client/server?
Should I change the build of MariaDB, so that one package includes files for both server and client, and the other package only includes client files? I don't know how to configure this
19.09 milestone? If this and aren't resolved by then we will have to add the client binaries back into the server package.
- this variant optimal?
update MariaDB configuration, please check this variant.
Fixed, mariadb package includes server and client binaries.