Change:
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.

Discussion:
<ins> diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 31291d26..fad52814 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -34,6 +34,11 @@ MACRO(MYSQL_ADD_PLUGIN) "LINK_LIBRARIES;DEPENDENCIES" ${ARGN} ) + +  IF(WITHOUT_SERVER OR ARG_CLIENT) +  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +  ENDIF() + IF(NOT WITHOUT_SERVER OR ARG_CLIENT) # Add common include directories </ins>

{ stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig, ncurses, zlib, xz, lzo, lz4, bzip2, snappy <del> , libiconv, openssl, pcre, boost, judy, bison, libxml2 </del> <ins> , libiconv, openssl, pcre, boost, judy, bison, libxml2, libkrb5 </ins> , libaio, libevent, jemalloc, cracklib, systemd, numactl, perl , fixDarwinDylibNames, cctools, CoreServices , asio, buildEnv, check, scons

}; common = rec { # attributes common to both builds <del> version = "10.2.17"; </del> <ins> version = "10.3.15"; </ins> src = fetchurl { urls = [ "https://downloads.mariadb.org/f/mariadb-${version}/source/mariadb-${version}.tar.gz" "https://downloads.mariadb.com/MariaDB/mariadb-${version}/source/mariadb-${version}.tar.gz" ]; <del> sha256 = "09xy6mgnz22mz8zgqlnddn8nzgs9xlz8lai4a7aa8x78in7hgcz7"; </del> <ins> sha256 = "0s399nxk2z8fgdr527p64y74zwjc3gpv7psf1n2r6ksl9njr3wr7"; </ins> name   = "mariadb-${version}.tar.gz"; };

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";

client = stdenv.mkDerivation (common // { name = "mariadb-client-${common.version}"; <del> outputs = [ "bin" "dev" "out" ]; </del> <ins> outputs = [ "out" "dev" "man" ]; </ins> propagatedBuildInputs = [ openssl zlib ]; # required from mariadb.pc <ins> patches = [ ./cmake-plugin-includedir.patch ]; </ins> cmakeFlags = common.cmakeFlags ++ [ "-DWITHOUT_SERVER=ON" <ins> "-DWITH_WSREP=OFF" </ins> ]; <del> preConfigure = common.preConfigure + '' cmakeFlags="$cmakeFlags  -DINSTALL_BINDIR=$bin/bin  -DINSTALL_SCRIPTDIR=$bin/bin  -DINSTALL_SUPPORTFILESDIR=$bin/share/mysql  -DINSTALL_DOCDIR=$bin/share/doc/mysql  -DINSTALL_DOCREADMEDIR=$bin/share/doc/mysql  " ''; # prevent cycle; it needs to reference $dev postInstall = common.postInstall + '' moveToOutput bin/mysql_config "$dev" moveToOutput bin/mariadb_config "$dev" </del> <ins> postInstall = '' rm -r "$out"/share/mysql rm -r "$out"/share/doc rm "$out"/bin/{msql2mysql,mysql_plugin,mytop,wsrep_sst_rsync_wan,mysql_config,mariadb_config} rm "$out"/lib/plugin/{daemon_example.ini,dialog.so,mysql_clear_password.so,sha256_password.so} rm "$out"/lib/{libmariadb.so,libmysqlclient.so,libmysqlclient_r.so} mv "$out"/lib/libmariadb.so.3 "$out"/lib/libmysqlclient.so ln -sv libmysqlclient.so "$out"/lib/libmysqlclient_r.so mkdir -p "$dev"/lib && mv "$out"/lib/{libmariadbclient.a,libmysqlclient.a,libmysqlclient_r.a,libmysqlservices.a} "$dev"/lib </ins> ''; enableParallelBuilding = true; # the client should be OK

everything = stdenv.mkDerivation (common // { name = "mariadb-${common.version}"; <ins> outputs = [ "out" "dev" "man" ]; </ins> nativeBuildInputs = common.nativeBuildInputs ++ [ bison ]; buildInputs = common.buildInputs ++ [

cmakeFlags = common.cmakeFlags ++ [ "-DMYSQL_DATADIR=/var/lib/mysql" <del> "-DINSTALL_SYSCONFDIR=etc/mysql" "-DINSTALL_INFODIR=share/mysql/docs" "-DINSTALL_MANDIR=share/man" </del> "-DINSTALL_PLUGINDIR=lib/mysql/plugin" <del> "-DINSTALL_SCRIPTDIR=bin" "-DINSTALL_SUPPORTFILESDIR=share/mysql" "-DINSTALL_DOCREADMEDIR=share/doc/mysql" "-DINSTALL_DOCDIR=share/doc/mysql" "-DINSTALL_SHAREDIR=share/mysql" "-DINSTALL_MYSQLTESTDIR=OFF" "-DINSTALL_SQLBENCHDIR=OFF" "-DENABLED_LOCAL_INFILE=ON" </del> <ins> "-DENABLED_LOCAL_INFILE=OFF" </ins> "-DWITH_READLINE=ON" <del> "-DWITH_EXTRA_CHARSETS=complex" "-DWITH_EMBEDDED_SERVER=ON" "-DWITH_ARCHIVE_STORAGE_ENGINE=1" "-DWITH_BLACKHOLE_STORAGE_ENGINE=1" "-DWITH_INNOBASE_STORAGE_ENGINE=1" "-DWITH_PARTITION_STORAGE_ENGINE=1" "-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1" "-DWITHOUT_FEDERATED_STORAGE_ENGINE=1" </del> <ins> "-DWITH_EXTRA_CHARSETS=all" "-DWITH_EMBEDDED_SERVER=OFF" "-DWITH_UNIT_TESTS=OFF" </ins> "-DWITH_WSREP=ON" "-DWITH_INNODB_DISALLOW_WRITES=ON" <ins> "-DWITHOUT_EXAMPLE=1" "-DWITHOUT_FEDERATED=1" </ins> ] ++ stdenv.lib.optionals stdenv.isDarwin [ <del> "-DWITHOUT_OQGRAPH_STORAGE_ENGINE=1" </del> <ins> "-DWITHOUT_OQGRAPH=1" </ins> "-DWITHOUT_TOKUDB=1" ]; <del> postInstall = common.postInstall + '' </del> <ins> preConfigure = '' cmakeFlags="$cmakeFlags  -DINSTALL_SHAREDIR=$dev/share/mysql -DINSTALL_SUPPORTFILESDIR=$dev/share/mysql" ''; postInstall = '' chmod +x "$out"/bin/wsrep_sst_common </ins> rm -r "$out"/data # Don't need testing data <del> rm "$out"/share/man/man1/mysql-test-run.pl.1 rm "$out"/bin/rcmysql </del> <ins> rm "$out"/bin/{mysql_find_rows,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck} rm "$out"/bin/{mysqldump,mysqlhotcopy,mysqlimport,mysqlshow,mysqlslap,mysqltest} rm "$out"/lib/mysql/plugin/{auth_gssapi_client.so,client_ed25519.so,daemon_example.ini} rm "$out"/lib/{libmysqlclient.so,libmysqlclient_r.so} mv "$out"/share/{groonga,groonga-normalizer-mysql} "$out"/share/doc/mysql mkdir -p "$dev"/lib && mv "$out"/lib/{libmariadbclient.a,libmysqlclient.a,libmysqlclient_r.a,libmysqlservices.a} "$dev"/lib </ins> '' + optionalString (! stdenv.isDarwin) '' sed -i 's/-mariadb/-mysql/' "$out"/bin/galera_new_cluster '';

<del> diff --git a/libmariadb/mariadb_config/mariadb_config.c.in b/libmariadb/mariadb_config/mariadb_config.c.in index 45d2f4e..e5666db 100644 --- a/libmariadb/mariadb_config/mariadb_config.c.in +++ b/libmariadb/mariadb_config/mariadb_config.c.in @@ -5,7 +5,7 @@ static char *mariadb_progname; -#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql" +#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@/mysql" #define LIBS    "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb @extra_dynamic_LDFLAGS@" #define LIBS_SYS "@extra_dynamic_LDFLAGS@" #define CFLAGS  INCLUDE </del>

mariadb = callPackage ../servers/sql/mariadb { asio = asio_1_10; <del> jemalloc = jemalloc.override ({ disableInitExecTls = true; }); </del> <ins> # As per mariadb's cmake, "static jemalloc_pic.a can only be used up to jemalloc 4". # https://jira.mariadb.org/browse/MDEV-15034 jemalloc = jemalloc450.override ({ disableInitExecTls = true; }); </ins> inherit (darwin) cctools; inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices; };