Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 149 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 pkg-config, 5 cmake, 6 fetchurl, 7 git, 8 cctools, 9 darwin, 10 makeWrapper, 11 bison, 12 openssl, 13 protobuf, 14 curl, 15 zlib, 16 libssh, 17 zstd, 18 lz4, 19 readline, 20 libtirpc, 21 rpcsvc-proto, 22 libedit, 23 libevent, 24 icu, 25 re2, 26 ncurses, 27 libfido2, 28 python3, 29 cyrus_sasl, 30 openldap, 31 antlr, 32}: 33 34let 35 pythonDeps = with python3.pkgs; [ 36 certifi 37 paramiko 38 pyyaml 39 ]; 40 41 mysqlShellVersion = "8.4.4"; 42 mysqlServerVersion = "8.4.4"; 43in 44stdenv.mkDerivation (finalAttrs: { 45 pname = "mysql-shell"; 46 version = mysqlShellVersion; 47 48 srcs = [ 49 (fetchurl { 50 url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor mysqlServerVersion}/mysql-${mysqlServerVersion}.tar.gz"; 51 hash = "sha256-+ykO90iJRDQIUknDG8pSrHGFMSREarIYuzvFAr8AgqU="; 52 }) 53 (fetchurl { 54 url = "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz"; 55 hash = "sha256-wl57vU3YbWvtmzew801k8WHohY6Fjy59Uyy2pdYaHuw="; 56 }) 57 ]; 58 59 sourceRoot = "mysql-shell-${finalAttrs.version}-src"; 60 61 postUnpack = '' 62 mv mysql-${mysqlServerVersion} mysql 63 ''; 64 65 patches = [ 66 # No openssl bundling on macOS. It's not working. 67 # See https://github.com/mysql/mysql-shell/blob/5b84e0be59fc0e027ef3f4920df15f7be97624c1/cmake/ssl.cmake#L53 68 ./no-openssl-bundling.patch 69 ]; 70 71 postPatch = '' 72 substituteInPlace ../mysql/cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool 73 substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace-fail /usr/bin/libtool libtool 74 75 substituteInPlace cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool 76 ''; 77 78 nativeBuildInputs = 79 [ 80 pkg-config 81 cmake 82 git 83 bison 84 makeWrapper 85 ] 86 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ] 87 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 88 cctools 89 darwin.DarwinTools 90 ]; 91 92 buildInputs = 93 [ 94 curl 95 libedit 96 libssh 97 lz4 98 openssl 99 protobuf 100 readline 101 zlib 102 zstd 103 libevent 104 icu 105 re2 106 ncurses 107 libfido2 108 cyrus_sasl 109 openldap 110 python3 111 antlr.runtime.cpp 112 ] 113 ++ pythonDeps 114 ++ lib.optionals stdenv.hostPlatform.isLinux [ libtirpc ] 115 ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.libutil ]; 116 117 preConfigure = '' 118 # Build MySQL 119 echo "Building mysqlclient mysqlxclient" 120 121 cmake -DWITH_SYSTEM_LIBS=ON -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \ 122 -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build 123 124 cmake --build ../mysql/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient 125 126 cmakeFlagsArray+=( 127 "-DMYSQL_SOURCE_DIR=''${NIX_BUILD_TOP}/mysql" 128 "-DMYSQL_BUILD_DIR=''${NIX_BUILD_TOP}/mysql/build" 129 "-DMYSQL_CONFIG_EXECUTABLE=''${NIX_BUILD_TOP}/mysql/build/scripts/mysql_config" 130 "-DWITH_ZSTD=system" 131 "-DWITH_LZ4=system" 132 "-DWITH_ZLIB=system" 133 "-DWITH_PROTOBUF=system" 134 "-DHAVE_PYTHON=1" 135 ) 136 ''; 137 138 postFixup = '' 139 wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}" 140 ''; 141 142 meta = { 143 homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/"; 144 description = "New command line scriptable shell for MySQL"; 145 license = lib.licenses.gpl2; 146 maintainers = with lib.maintainers; [ aaronjheng ]; 147 mainProgram = "mysqlsh"; 148 }; 149})