2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, pkg-config
|
|
|
|
, cmake
|
|
|
|
, fetchurl
|
|
|
|
, git
|
2022-11-21 17:40:18 +00:00
|
|
|
, cctools
|
|
|
|
, developer_cmds
|
|
|
|
, DarwinTools
|
|
|
|
, makeWrapper
|
|
|
|
, CoreServices
|
2022-04-27 09:35:20 +00:00
|
|
|
, bison
|
|
|
|
, openssl
|
|
|
|
, protobuf
|
|
|
|
, curl
|
|
|
|
, zlib
|
|
|
|
, libssh
|
|
|
|
, zstd
|
|
|
|
, lz4
|
|
|
|
, boost
|
|
|
|
, readline
|
|
|
|
, libtirpc
|
|
|
|
, rpcsvc-proto
|
|
|
|
, libedit
|
|
|
|
, libevent
|
|
|
|
, icu
|
|
|
|
, re2
|
|
|
|
, ncurses
|
|
|
|
, libfido2
|
|
|
|
, v8
|
|
|
|
, python3
|
|
|
|
, cyrus_sasl
|
|
|
|
, openldap
|
2022-11-21 17:40:18 +00:00
|
|
|
, antlr
|
2022-04-27 09:35:20 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-07-18 16:21:45 +00:00
|
|
|
pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];
|
2022-04-27 09:35:20 +00:00
|
|
|
in
|
2022-11-21 17:40:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2022-04-27 09:35:20 +00:00
|
|
|
pname = "mysql-shell";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "8.0.32";
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
srcs = [
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${version}-src.tar.gz";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-GUkeZ856/olOssiqkb3qc8ddnianVGXwrcW6hrIG3wE=";
|
2022-04-27 09:35:20 +00:00
|
|
|
})
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor version}/mysql-${version}.tar.gz";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-Hw2SojeJgkRxbdWB95k1bgc8LaY8Oy5KAeEDLL7VDig=";
|
2022-04-27 09:35:20 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
sourceRoot = "mysql-shell-${version}-src";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ../mysql-${version}/cmake/libutils.cmake --replace /usr/bin/libtool libtool
|
|
|
|
substituteInPlace ../mysql-${version}/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
|
|
|
|
|
|
|
|
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
|
|
|
|
'';
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ cctools developer_cmds DarwinTools ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
curl
|
|
|
|
libedit
|
|
|
|
libssh
|
|
|
|
lz4
|
|
|
|
openssl
|
|
|
|
protobuf
|
|
|
|
readline
|
|
|
|
zlib
|
|
|
|
zstd
|
|
|
|
libevent
|
|
|
|
icu
|
|
|
|
re2
|
|
|
|
ncurses
|
|
|
|
libfido2
|
|
|
|
cyrus_sasl
|
|
|
|
openldap
|
|
|
|
v8
|
2022-05-18 14:49:53 +00:00
|
|
|
python3
|
2022-11-21 17:40:18 +00:00
|
|
|
antlr.runtime.cpp
|
|
|
|
] ++ pythonDeps
|
|
|
|
++ lib.optionals stdenv.isLinux [ libtirpc ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ CoreServices ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# Build MySQL
|
2022-11-21 17:40:18 +00:00
|
|
|
echo "Building mysqlclient mysqlxclient"
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
cmake -DWITH_BOOST=system -DWITH_SYSTEM_LIBS=ON -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
|
|
|
|
-DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql-${version} -B ../mysql-${version}/build
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
cmake --build ../mysql-${version}/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DMYSQL_SOURCE_DIR=../mysql-${version}"
|
|
|
|
"-DMYSQL_BUILD_DIR=../mysql-${version}/build"
|
|
|
|
"-DMYSQL_CONFIG_EXECUTABLE=../../mysql-${version}/build/scripts/mysql_config"
|
|
|
|
"-DWITH_ZSTD=system"
|
|
|
|
"-DWITH_LZ4=system"
|
|
|
|
"-DWITH_ZLIB=system"
|
|
|
|
"-DWITH_PROTOBUF=${protobuf}"
|
|
|
|
"-DHAVE_V8=1"
|
|
|
|
"-DV8_INCLUDE_DIR=${v8}/include"
|
2022-08-12 12:06:08 +00:00
|
|
|
"-DV8_LIB_DIR=${v8}/lib"
|
2022-04-27 09:35:20 +00:00
|
|
|
"-DHAVE_PYTHON=1"
|
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
CXXFLAGS = [ "-DV8_COMPRESS_POINTERS=1" "-DV8_31BIT_SMIS_ON_64BIT_ARCH=1" ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
postFixup = ''
|
2022-11-21 17:40:18 +00:00
|
|
|
wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}"
|
2022-07-18 16:21:45 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor version}/en/";
|
|
|
|
description = "A new command line scriptable shell for MySQL";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ aaronjheng ];
|
|
|
|
mainProgram = "mysqlsh";
|
|
|
|
};
|
|
|
|
}
|