1 { lib, stdenv, fetchurl, bison, cmake, pkg-config
2 , boost, icu, libedit, libevent, lz4, ncurses, openssl, perl, protobuf, re2, readline, zlib, zstd, libfido2
3 , numactl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools, nixosTests
4 # Percona-specific deps
5 , coreutils, cyrus_sasl, gnumake, openldap
8 stdenv.mkDerivation (finalAttrs: {
9 pname = "percona-server_lts";
10 version = "8.0.36-28";
13 url = "https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-${finalAttrs.version}/source/tarball/percona-server-${finalAttrs.version}.tar.gz";
14 hash = "sha256-iktEvZz3mjjmJ16PX51OjSwwiFS3H9W/XRco//Q6aEQ=";
17 nativeBuildInputs = [ bison cmake pkg-config ]
18 ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
21 ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
24 ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
26 substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
27 substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
28 # The rocksdb setup script is called with `env -i` and cannot find anything in PATH.
29 patchShebangs storage/rocksdb/get_rocksdb_files.sh
30 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace mktemp ${coreutils}/bin/mktemp
31 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "rm $MKFILE" "${coreutils}/bin/rm $MKFILE"
32 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "make --" "${gnumake}/bin/make --"
36 boost (curl.override { inherit openssl; }) icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
37 zstd libfido2 openldap perl cyrus_sasl
38 ] ++ lib.optionals stdenv.isLinux [
40 ] ++ lib.optionals stdenv.isDarwin [
41 cctools CoreServices developer_cmds DarwinTools
44 outputs = [ "out" "static" ];
47 # Percona-specific flags.
50 "-DROCKSDB_DISABLE_AVX2=1"
51 "-DROCKSDB_DISABLE_MARCH_NATIVE=1"
53 # Flags taken from mysql package.
54 "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
55 "-DWITH_ROUTER=OFF" # It may be packaged separately.
56 "-DWITH_SYSTEM_LIBS=ON"
57 "-DWITH_UNIT_TESTS=OFF"
58 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
59 "-DMYSQL_DATADIR=/var/lib/mysql"
60 "-DINSTALL_INFODIR=share/mysql/docs"
61 "-DINSTALL_MANDIR=share/man"
62 "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
63 "-DINSTALL_INCLUDEDIR=include/mysql"
64 "-DINSTALL_DOCREADMEDIR=share/mysql"
65 "-DINSTALL_SUPPORTFILESDIR=share/mysql"
66 "-DINSTALL_MYSQLSHAREDIR=share/mysql"
67 "-DINSTALL_MYSQLTESTDIR="
68 "-DINSTALL_DOCDIR=share/mysql/docs"
69 "-DINSTALL_SHAREDIR=share/mysql"
73 moveToOutput "lib/*.a" $static
74 so=${stdenv.hostPlatform.extensions.sharedLibrary}
75 ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
79 client = finalAttrs.finalPackage;
80 connector-c = finalAttrs.finalPackage;
81 server = finalAttrs.finalPackage;
82 mysqlVersion = lib.versions.majorMinor finalAttrs.version;
83 tests = nixosTests.mysql.percona-server_lts;
87 homepage = "https://www.percona.com/software/mysql-database/percona-server";
89 A free, fully compatible, enhanced, open source drop-in replacement for
90 MySQL® that provides superior performance, scalability and instrumentation.
92 license = licenses.gpl2Plus;
93 maintainers = teams.flyingcircus.members;
94 platforms = platforms.unix;