2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, pkg-config
|
|
|
|
, cmake
|
|
|
|
, fetchurl
|
|
|
|
, git
|
2022-11-21 17:40:18 +00:00
|
|
|
, cctools
|
|
|
|
, 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
|
|
|
|
, 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
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-04-27 09:35:20 +00:00
|
|
|
pname = "mysql-shell";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "8.0.37";
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
srcs = [
|
|
|
|
(fetchurl {
|
2024-05-15 15:35:15 +00:00
|
|
|
url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
|
|
|
|
hash = "sha256-4GOgkazZ7EC7BfLATfZPiZan5OJuiDu2UChJ1fa0pho=";
|
2022-04-27 09:35:20 +00:00
|
|
|
})
|
|
|
|
(fetchurl {
|
2024-05-15 15:35:15 +00:00
|
|
|
url = "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
|
|
|
|
hash = "sha256-UtZ7/Ip5h9CXKy3lkSt8/TXJgbPPUO73rMSIFPfX0Is=";
|
2022-04-27 09:35:20 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
sourceRoot = "mysql-shell-${finalAttrs.version}-src";
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mv mysql-${finalAttrs.version} mysql
|
|
|
|
'';
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
substituteInPlace ../mysql/cmake/libutils.cmake --replace /usr/bin/libtool libtool
|
|
|
|
substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
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 ]
|
2023-11-16 04:20:00 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ cctools 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
|
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"
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
cmake -DWITH_SYSTEM_LIBS=ON -DWITH_BOOST=system -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
|
2023-10-09 19:29:22 +00:00
|
|
|
-DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
cmake --build ../mysql/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
|
2022-04-27 09:35:20 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DMYSQL_SOURCE_DIR=../mysql"
|
|
|
|
"-DMYSQL_BUILD_DIR=../mysql/build"
|
|
|
|
"-DMYSQL_CONFIG_EXECUTABLE=../../mysql/build/scripts/mysql_config"
|
2022-04-27 09:35:20 +00:00
|
|
|
"-DWITH_ZSTD=system"
|
|
|
|
"-DWITH_LZ4=system"
|
|
|
|
"-DWITH_ZLIB=system"
|
|
|
|
"-DWITH_PROTOBUF=${protobuf}"
|
|
|
|
"-DHAVE_PYTHON=1"
|
|
|
|
];
|
|
|
|
|
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; {
|
2023-10-09 19:29:22 +00:00
|
|
|
homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/";
|
2022-04-27 09:35:20 +00:00
|
|
|
description = "A new command line scriptable shell for MySQL";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ aaronjheng ];
|
|
|
|
mainProgram = "mysqlsh";
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|