nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 130 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 bison, 6 cmake, 7 pkg-config, 8 boost, 9 icu, 10 libedit, 11 libevent, 12 lz4, 13 ncurses, 14 openssl, 15 protobuf, 16 re2, 17 readline, 18 zlib, 19 zstd, 20 libfido2, 21 numactl, 22 cctools, 23 developer_cmds, 24 libtirpc, 25 rpcsvc-proto, 26 curl, 27 DarwinTools, 28 nixosTests, 29}: 30 31stdenv.mkDerivation (finalAttrs: { 32 pname = "mysql"; 33 version = "8.0.45"; 34 35 src = fetchurl { 36 url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz"; 37 hash = "sha256-tDXyLmWMj8k7gWmPo0uaVjJaMEs/Pf+H8n+2dMkKu8s="; 38 }; 39 40 nativeBuildInputs = [ 41 bison 42 cmake 43 pkg-config 44 protobuf 45 ] 46 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ]; 47 48 patches = [ 49 ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch 50 ]; 51 52 ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references. 53 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 54 substituteInPlace cmake/libutils.cmake --replace-fail /usr/bin/libtool ${cctools}/bin/libtool 55 substituteInPlace cmake/os/Darwin.cmake --replace-fail /usr/bin/libtool ${cctools}/bin/libtool 56 substituteInPlace cmake/package_name.cmake --replace-fail "COMMAND sw_vers" "COMMAND ${DarwinTools}/bin/sw_vers" 57 ''; 58 59 buildInputs = [ 60 boost 61 (curl.override { inherit openssl; }) 62 icu 63 libedit 64 libevent 65 lz4 66 ncurses 67 openssl 68 protobuf 69 re2 70 readline 71 zlib 72 zstd 73 libfido2 74 ] 75 ++ lib.optionals stdenv.hostPlatform.isLinux [ 76 numactl 77 libtirpc 78 ] 79 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 80 developer_cmds 81 ]; 82 83 strictDeps = true; 84 85 outputs = [ 86 "out" 87 "static" 88 ]; 89 90 cmakeFlags = [ 91 "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin. 92 "-DWITH_ROUTER=OFF" # It may be packaged separately. 93 "-DWITH_SYSTEM_LIBS=ON" 94 "-DWITH_UNIT_TESTS=OFF" 95 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock" 96 "-DMYSQL_DATADIR=/var/lib/mysql" 97 "-DINSTALL_INFODIR=share/mysql/docs" 98 "-DINSTALL_MANDIR=share/man" 99 "-DINSTALL_PLUGINDIR=lib/mysql/plugin" 100 "-DINSTALL_INCLUDEDIR=include/mysql" 101 "-DINSTALL_DOCREADMEDIR=share/mysql" 102 "-DINSTALL_SUPPORTFILESDIR=share/mysql" 103 "-DINSTALL_MYSQLSHAREDIR=share/mysql" 104 "-DINSTALL_MYSQLTESTDIR=" 105 "-DINSTALL_DOCDIR=share/mysql/docs" 106 "-DINSTALL_SHAREDIR=share/mysql" 107 ]; 108 109 postInstall = '' 110 moveToOutput "lib/*.a" $static 111 so=${stdenv.hostPlatform.extensions.sharedLibrary} 112 ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so 113 ''; 114 115 passthru = { 116 client = finalAttrs.finalPackage; 117 connector-c = finalAttrs.finalPackage; 118 server = finalAttrs.finalPackage; 119 mysqlVersion = lib.versions.majorMinor finalAttrs.version; 120 tests = nixosTests.mysql.mysql80; 121 }; 122 123 meta = { 124 homepage = "https://www.mysql.com/"; 125 description = "World's most popular open source database"; 126 license = lib.licenses.gpl2Only; 127 maintainers = [ ]; 128 platforms = lib.platforms.unix; 129 }; 130})