nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 131 lines 3.2 kB view raw
1{ lib 2, stdenv 3, pkg-config 4, cmake 5, fetchurl 6, git 7, bison 8, openssl 9, protobuf 10, curl 11, zlib 12, libssh 13, zstd 14, lz4 15, boost 16, readline 17, libtirpc 18, rpcsvc-proto 19, libedit 20, libevent 21, icu 22, re2 23, ncurses 24, libfido2 25, v8 26, python3 27, cyrus_sasl 28, openldap 29, numactl 30, cctools 31, CoreServices 32, developer_cmds 33, DarwinTools 34}: 35 36let 37 pythonDeps = [ python3.pkgs.certifi python3.pkgs.paramiko ]; 38 site = '' 39 40 import sys; sys.path.extend([${lib.concatStringsSep ", " (map (x: ''"${x}/${python3.sitePackages}"'') pythonDeps)}]) 41 ''; 42in 43stdenv.mkDerivation rec{ 44 pname = "mysql-shell"; 45 version = "8.0.29"; 46 47 srcs = [ 48 (fetchurl { 49 url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${version}-src.tar.gz"; 50 sha256 = "sha256-ijwyamQgMoUEcMNpIJjJxH/dRuRFpdcXGmQqpD+WrmA="; 51 }) 52 (fetchurl { 53 url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor version}/mysql-${version}.tar.gz"; 54 sha256 = "sha256-USFw+m94ppTW8Y0ZfpmdJxbuaNxUHXZE3ZIqNmNAcmY="; 55 }) 56 ]; 57 58 sourceRoot = "mysql-shell-${version}-src"; 59 60 postPatch = '' 61 substituteInPlace ../mysql-${version}/cmake/libutils.cmake --replace /usr/bin/libtool libtool 62 substituteInPlace ../mysql-${version}/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool 63 64 substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool 65 66 # For python dependencies 67 echo '${site}' >> python/packages/mysqlsh/__init__.py 68 ''; 69 70 nativeBuildInputs = [ pkg-config cmake git bison ] ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ]; 71 72 buildInputs = [ 73 boost 74 curl 75 libedit 76 libssh 77 lz4 78 openssl 79 protobuf 80 readline 81 zlib 82 zstd 83 libevent 84 icu 85 re2 86 ncurses 87 libfido2 88 cyrus_sasl 89 openldap 90 v8 91 python3 92 ] ++ pythonDeps ++ lib.optionals stdenv.isLinux [ 93 numactl 94 libtirpc 95 ] ++ lib.optionals stdenv.isDarwin [ cctools CoreServices developer_cmds DarwinTools ]; 96 97 preConfigure = '' 98 # Build MySQL 99 cmake -DWITH_BOOST=system -DWITH_SYSTEM_LIBS=ON -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \ 100 -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql-${version} -B ../mysql-${version}/build 101 102 cmake --build ../mysql-${version}/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient 103 104 # Get libv8_monolith 105 mkdir -p ../v8/lib && ln -s ${v8}/lib/libv8.a ../v8/lib/libv8_monolith.a 106 ''; 107 108 cmakeFlags = [ 109 "-DMYSQL_SOURCE_DIR=../mysql-${version}" 110 "-DMYSQL_BUILD_DIR=../mysql-${version}/build" 111 "-DMYSQL_CONFIG_EXECUTABLE=../../mysql-${version}/build/scripts/mysql_config" 112 "-DWITH_ZSTD=system" 113 "-DWITH_LZ4=system" 114 "-DWITH_ZLIB=system" 115 "-DWITH_PROTOBUF=${protobuf}" 116 "-DHAVE_V8=1" 117 "-DV8_INCLUDE_DIR=${v8}/include" 118 "-DV8_LIB_DIR=../v8/lib" 119 "-DHAVE_PYTHON=1" 120 ]; 121 122 CXXFLAGS = [ "-DV8_COMPRESS_POINTERS=1" "-DV8_31BIT_SMIS_ON_64BIT_ARCH=1" ]; 123 124 meta = with lib; { 125 homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor version}/en/"; 126 description = "A new command line scriptable shell for MySQL"; 127 license = licenses.gpl2; 128 maintainers = with maintainers; [ aaronjheng ]; 129 mainProgram = "mysqlsh"; 130 }; 131}