1 { lib, stdenv, fetchurl, bison, cmake, pkg-config
2 , boost, icu, libedit, libevent, lz4, ncurses, openssl, protobuf, re2, readline, zlib, zstd, libfido2
3 , numactl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools, nixosTests
6 stdenv.mkDerivation (finalAttrs: {
11 url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
12 hash = "sha256-0qXCL4tWLX4PEdm441yYeaUWYDlCTBNCclN9Ao1yGRQ=";
15 nativeBuildInputs = [ bison cmake pkg-config ]
16 ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
19 ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
22 ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
24 substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
25 substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
29 boost (curl.override { inherit openssl; }) icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
31 ] ++ lib.optionals stdenv.isLinux [
33 ] ++ lib.optionals stdenv.isDarwin [
34 cctools CoreServices developer_cmds DarwinTools
37 outputs = [ "out" "static" ];
40 "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
41 "-DWITH_ROUTER=OFF" # It may be packaged separately.
42 "-DWITH_SYSTEM_LIBS=ON"
43 "-DWITH_UNIT_TESTS=OFF"
44 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
45 "-DMYSQL_DATADIR=/var/lib/mysql"
46 "-DINSTALL_INFODIR=share/mysql/docs"
47 "-DINSTALL_MANDIR=share/man"
48 "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
49 "-DINSTALL_INCLUDEDIR=include/mysql"
50 "-DINSTALL_DOCREADMEDIR=share/mysql"
51 "-DINSTALL_SUPPORTFILESDIR=share/mysql"
52 "-DINSTALL_MYSQLSHAREDIR=share/mysql"
53 "-DINSTALL_MYSQLTESTDIR="
54 "-DINSTALL_DOCDIR=share/mysql/docs"
55 "-DINSTALL_SHAREDIR=share/mysql"
59 moveToOutput "lib/*.a" $static
60 so=${stdenv.hostPlatform.extensions.sharedLibrary}
61 ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
65 client = finalAttrs.finalPackage;
66 connector-c = finalAttrs.finalPackage;
67 server = finalAttrs.finalPackage;
68 mysqlVersion = lib.versions.majorMinor finalAttrs.version;
69 tests = nixosTests.mysql.mysql80;
73 homepage = "https://www.mysql.com/";
74 description = "World's most popular open source database";
75 license = licenses.gpl2Only;
76 maintainers = with maintainers; [ orivej ];
77 platforms = platforms.unix;