Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 215 lines 5.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 gitUpdater, 7 bison, 8 cmake, 9 pkg-config, 10 boost, 11 icu, 12 libedit, 13 libevent, 14 lz4, 15 ncurses, 16 openssl, 17 perl, 18 protobuf, 19 re2, 20 readline, 21 zlib, 22 zstd, 23 libfido2, 24 numactl, 25 cctools, 26 developer_cmds, 27 libtirpc, 28 rpcsvc-proto, 29 curl, 30 DarwinTools, 31 nixosTests, 32 coreutils, 33 procps, 34 gnused, 35 gnugrep, 36 hostname, 37 makeWrapper, 38 # Percona-specific deps 39 cyrus_sasl, 40 gnumake, 41 openldap, 42}: 43 44stdenv.mkDerivation (finalAttrs: { 45 pname = "percona-server"; 46 version = "8.0.42-33"; 47 48 src = fetchurl { 49 url = "https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-${finalAttrs.version}/source/tarball/percona-server-${finalAttrs.version}.tar.gz"; 50 hash = "sha256-UDdmBz1RVjX/kRivvk69GPdtjLjWTglKxteiLxXKQGc="; 51 }; 52 53 nativeBuildInputs = [ 54 bison 55 cmake 56 pkg-config 57 makeWrapper 58 # required for scripts/CMakeLists.txt 59 coreutils 60 gnugrep 61 procps 62 ] 63 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ]; 64 65 patches = [ 66 # adapted from mysql80's llvm 19 fixes 67 ./libcpp-fixes.patch 68 # fixes using -DWITH_SSL=system with CMAKE_PREFIX_PATH on darwin 69 # https://github.com/Homebrew/homebrew-core/pull/204799 70 (fetchpatch { 71 name = "fix-system-ssl-darwin.patch"; 72 url = "https://github.com/percona/percona-server/pull/5537/commits/a693e5d67abf6f27f5284c86361604babec529c6.patch"; 73 hash = "sha256-fFBy3AYTMLvHvbsh0g0UvuPkmVMKZzxPsxeBKbsN8Ho="; 74 }) 75 ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch 76 ./coredumper-explicitly-import-unistd.patch # fix build on aarch64-linux 77 ]; 78 79 ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references. 80 postPatch = '' 81 substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool 82 substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool 83 # The rocksdb setup script is called with `env -i` and cannot find anything in PATH. 84 patchShebangs storage/rocksdb/get_rocksdb_files.sh 85 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace mktemp ${coreutils}/bin/mktemp 86 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "rm $MKFILE" "${coreutils}/bin/rm $MKFILE" 87 substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "make --" "${gnumake}/bin/make --" 88 ''; 89 90 buildInputs = [ 91 boost 92 (curl.override { inherit openssl; }) 93 icu 94 libedit 95 libevent 96 lz4 97 ncurses 98 openssl 99 protobuf 100 re2 101 readline 102 zlib 103 zstd 104 libfido2 105 openldap 106 perl 107 cyrus_sasl 108 ] 109 ++ lib.optionals stdenv.hostPlatform.isLinux [ 110 numactl 111 libtirpc 112 ] 113 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 114 cctools 115 developer_cmds 116 DarwinTools 117 ]; 118 119 outputs = [ 120 "out" 121 "static" 122 ]; 123 124 cmakeFlags = [ 125 # Percona-specific flags. 126 "-DPORTABLE=1" 127 "-DWITH_LDAP=system" 128 "-DROCKSDB_DISABLE_AVX2=1" 129 "-DROCKSDB_DISABLE_MARCH_NATIVE=1" 130 131 # Flags taken from mysql package. 132 "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin. 133 "-DWITH_ROUTER=OFF" # It may be packaged separately. 134 "-DWITH_SYSTEM_LIBS=ON" 135 "-DWITH_UNIT_TESTS=OFF" 136 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock" 137 "-DMYSQL_DATADIR=/var/lib/mysql" 138 "-DINSTALL_INFODIR=share/mysql/docs" 139 "-DINSTALL_MANDIR=share/man" 140 "-DINSTALL_PLUGINDIR=lib/mysql/plugin" 141 "-DINSTALL_INCLUDEDIR=include/mysql" 142 "-DINSTALL_DOCREADMEDIR=share/mysql" 143 "-DINSTALL_SUPPORTFILESDIR=share/mysql" 144 "-DINSTALL_MYSQLSHAREDIR=share/mysql" 145 "-DINSTALL_MYSQLTESTDIR=" 146 "-DINSTALL_DOCDIR=share/mysql/docs" 147 "-DINSTALL_SHAREDIR=share/mysql" 148 ]; 149 150 postInstall = '' 151 moveToOutput "lib/*.a" $static 152 so=${stdenv.hostPlatform.extensions.sharedLibrary} 153 ln -s libperconaserverclient$so $out/lib/libmysqlclient_r$so 154 155 wrapProgram $out/bin/mysqld_safe --prefix PATH : ${ 156 lib.makeBinPath [ 157 coreutils 158 procps 159 gnugrep 160 gnused 161 hostname 162 ] 163 } 164 wrapProgram $out/bin/mysql_config --prefix PATH : ${ 165 lib.makeBinPath [ 166 coreutils 167 gnused 168 ] 169 } 170 wrapProgram $out/bin/ps_mysqld_helper --prefix PATH : ${ 171 lib.makeBinPath [ 172 coreutils 173 gnugrep 174 ] 175 } 176 wrapProgram $out/bin/ps-admin --prefix PATH : ${ 177 lib.makeBinPath [ 178 coreutils 179 gnugrep 180 ] 181 } 182 wrapProgram $out/bin/mysqld_multi --prefix PATH : ${ 183 lib.makeBinPath [ 184 coreutils 185 gnugrep 186 ] 187 } 188 ''; 189 190 passthru = { 191 client = finalAttrs.finalPackage; 192 connector-c = finalAttrs.finalPackage; 193 server = finalAttrs.finalPackage; 194 mysqlVersion = lib.versions.majorMinor finalAttrs.version; 195 tests.percona-server = 196 nixosTests.mysql."percona-server_${lib.versions.major finalAttrs.version}_${lib.versions.minor finalAttrs.version}"; 197 updateScript = gitUpdater { 198 url = "https://github.com/percona/percona-server"; 199 rev-prefix = "Percona-Server-"; 200 allowedVersions = "${lib.versions.major finalAttrs.version}\\.${lib.versions.minor finalAttrs.version}\\..+"; 201 }; 202 }; 203 204 meta = with lib; { 205 homepage = "https://www.percona.com/software/mysql-database/percona-server"; 206 description = '' 207 A free, fully compatible, enhanced, open source drop-in replacement for 208 MySQL® that provides superior performance, scalability and instrumentation. 209 Long-term support release. 210 ''; 211 license = licenses.gpl2Only; 212 teams = [ teams.flyingcircus ]; 213 platforms = platforms.unix; 214 }; 215})