nixpkgs/pkgs/development/tools/mysql-shell/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

127 lines
2.9 KiB
Nix
Raw Normal View History

2022-02-22 09:51:52 +00:00
{ lib
, stdenv
, pkg-config
, cmake
, fetchurl
, git
2022-10-13 05:42:52 +00:00
, cctools
, DarwinTools
, makeWrapper
, CoreServices
2022-02-22 09:51:52 +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-10-13 05:42:52 +00:00
, antlr
2022-02-22 09:51:52 +00:00
}:
let
pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];
2022-02-22 09:51:52 +00:00
in
2023-09-23 02:48:31 +00:00
stdenv.mkDerivation (finalAttrs: {
2022-02-22 09:51:52 +00:00
pname = "mysql-shell";
2024-01-17 07:52:28 +00:00
version = "8.0.36";
2022-02-22 09:51:52 +00:00
srcs = [
(fetchurl {
2023-09-23 02:48:31 +00:00
url = "https://cdn.mysql.com//Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
2024-01-17 07:52:28 +00:00
hash = "sha256-9PJwa5WKinOA72yVjdlyMHvb7qRR76/DQuTEbim36d0=";
2022-02-22 09:51:52 +00:00
})
(fetchurl {
2023-09-23 02:48:31 +00:00
url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
2024-01-17 07:52:28 +00:00
hash = "sha256-s0+7dbcLcgS8u/6p7vpVAV9sR2gf2j9VDnSCJvw77fQ=";
2022-02-22 09:51:52 +00:00
})
];
2023-09-23 02:48:31 +00:00
sourceRoot = "mysql-shell-${finalAttrs.version}-src";
postUnpack = ''
mv mysql-${finalAttrs.version} mysql
'';
2022-02-22 09:51:52 +00:00
postPatch = ''
2023-09-23 02:48:31 +00:00
substituteInPlace ../mysql/cmake/libutils.cmake --replace /usr/bin/libtool libtool
substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
2022-02-22 09:51:52 +00:00
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
'';
2022-10-13 05:42:52 +00:00
nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ]
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ]
2023-10-30 02:07:36 +00:00
++ lib.optionals stdenv.isDarwin [ cctools DarwinTools ];
2022-02-22 09:51:52 +00:00
buildInputs = [
boost
curl
libedit
libssh
lz4
openssl
protobuf
readline
zlib
zstd
libevent
icu
re2
ncurses
libfido2
cyrus_sasl
openldap
2022-04-27 01:40:37 +00:00
python3
2022-10-13 05:42:52 +00:00
antlr.runtime.cpp
] ++ pythonDeps
++ lib.optionals stdenv.isLinux [ libtirpc ]
++ lib.optionals stdenv.isDarwin [ CoreServices ];
2022-02-22 09:51:52 +00:00
preConfigure = ''
# Build MySQL
2022-10-13 05:42:52 +00:00
echo "Building mysqlclient mysqlxclient"
2024-01-17 07:52:28 +00:00
cmake -DWITH_SYSTEM_LIBS=ON -DWITH_BOOST=system -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
2023-09-23 02:48:31 +00:00
-DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build
2022-02-22 09:51:52 +00:00
2023-09-23 02:48:31 +00:00
cmake --build ../mysql/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
2022-02-22 09:51:52 +00:00
'';
cmakeFlags = [
2023-09-23 02:48:31 +00:00
"-DMYSQL_SOURCE_DIR=../mysql"
"-DMYSQL_BUILD_DIR=../mysql/build"
"-DMYSQL_CONFIG_EXECUTABLE=../../mysql/build/scripts/mysql_config"
2022-02-22 09:51:52 +00:00
"-DWITH_ZSTD=system"
"-DWITH_LZ4=system"
"-DWITH_ZLIB=system"
"-DWITH_PROTOBUF=${protobuf}"
"-DHAVE_PYTHON=1"
];
postFixup = ''
2022-10-13 05:42:52 +00:00
wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}"
'';
2022-02-22 09:51:52 +00:00
meta = with lib; {
2023-09-23 02:48:31 +00:00
homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/";
2022-02-22 09:51:52 +00:00
description = "A new command line scriptable shell for MySQL";
license = licenses.gpl2;
maintainers = with maintainers; [ aaronjheng ];
mainProgram = "mysqlsh";
};
2023-09-23 02:48:31 +00:00
})