Unverified Commit 40842be9 authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #256806 from aaronjheng/mysql-shell

mysql-shell: use finalAttrs
parents 50aab076 d0585fc1
Loading
Loading
Loading
Loading
+19 −16
Original line number Diff line number Diff line
@@ -36,26 +36,30 @@
let
  pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "mysql-shell";
  version = "8.0.34";

  srcs = [
    (fetchurl {
      url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${version}-src.tar.gz";
      hash = "sha256-QY1PmhGw3PhqZ79+H/Xbb9uOvmrBlFQRS7idnV5OXF0=";
      url = "https://cdn.mysql.com//Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
      hash = "sha256-5l0Do8QmGLX7+ZBCrtMyCUAumyeqYsfIdD/9R4jY2x0=";
    })
    (fetchurl {
      url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor version}/mysql-${version}.tar.gz";
      hash = "sha256-5l0Do8QmGLX7+ZBCrtMyCUAumyeqYsfIdD/9R4jY2x0=";
      url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
      hash = "sha256-QY1PmhGw3PhqZ79+H/Xbb9uOvmrBlFQRS7idnV5OXF0=";
    })
  ];

  sourceRoot = "mysql-shell-${version}-src";
  sourceRoot = "mysql-shell-${finalAttrs.version}-src";

  postUnpack = ''
    mv mysql-${finalAttrs.version} mysql
  '';

  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 ../mysql/cmake/libutils.cmake --replace /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool

    substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
  '';
@@ -93,20 +97,19 @@ stdenv.mkDerivation rec {
    echo "Building mysqlclient mysqlxclient"

    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
      -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build

    cmake --build ../mysql-${version}/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
    cmake --build ../mysql/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"
    "-DMYSQL_SOURCE_DIR=../mysql"
    "-DMYSQL_BUILD_DIR=../mysql/build"
    "-DMYSQL_CONFIG_EXECUTABLE=../../mysql/build/scripts/mysql_config"
    "-DWITH_ZSTD=system"
    "-DWITH_LZ4=system"
    "-DWITH_ZLIB=system"
    "-DWITH_PROTOBUF=${protobuf}"
    "-DHAVE_V8=0" # V8 10.x required.
    "-DHAVE_PYTHON=1"
  ];

@@ -115,10 +118,10 @@ stdenv.mkDerivation rec {
  '';

  meta = with lib; {
    homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor version}/en/";
    homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/";
    description = "A new command line scriptable shell for MySQL";
    license = licenses.gpl2;
    maintainers = with maintainers; [ aaronjheng ];
    mainProgram = "mysqlsh";
  };
}
})
+1 −0
Original line number Diff line number Diff line
@@ -1078,6 +1078,7 @@ with pkgs;
    antlr = antlr4_10;
    boost = boost177; # Configure checks for specific version.
    icu =  icu69;
    protobuf = protobuf3_21;
  };
  broadlink-cli = callPackage ../tools/misc/broadlink-cli { };