1{ stdenv 2, lib 3, buildPythonPackage 4, django 5, dnspython 6, fetchFromGitHub 7, protobuf 8, pythonOlder 9, mysql80 10, openssl 11, pkgs 12}: 13 14buildPythonPackage rec { 15 pname = "mysql-connector"; 16 version = "8.0.33"; 17 format = "setuptools"; 18 19 disabled = pythonOlder "3.7"; 20 21 setupPyBuildFlags = [ 22 "--with-mysql-capi=\"${mysql80}\"" 23 "--with-openssl-include-dir=\"${openssl.dev}/include\"" 24 "--with-openssl-lib-dir=\"${lib.getLib openssl}/lib\"" 25 "-L \"${lib.getLib pkgs.zstd}/lib:${lib.getLib mysql80}/lib\"" 26 ]; 27 28 src = fetchFromGitHub { 29 owner = "mysql"; 30 repo = "mysql-connector-python"; 31 rev = version; 32 hash = "sha256-GtMq7E2qBqFu54hjUotzPyxScTKXNdEQcmgHnS7lBhc="; 33 }; 34 35 patches = [ 36 # mysql-connector overrides MACOSX_DEPLOYMENT_TARGET to 11. 37 # This makes the installation with nixpkgs fail. I suspect, that's 38 # because stdenv.hostPlatform.darwinSdkVersion is (currently) set to 39 # 10.12. The patch reverts 40 # https://github.com/mysql/mysql-connector-python/commit/d1e89fd3d7391084cdf35b0806cb5d2a4b413654 41 ./0001-Revert-Fix-MacOS-wheels-platform-tag.patch 42 ]; 43 44 nativeBuildInputs = [ 45 mysql80 46 ]; 47 48 49 propagatedBuildInputs = [ 50 dnspython 51 protobuf 52 mysql80 53 openssl 54 pkgs.zstd 55 ]; 56 57 pythonImportsCheck = [ 58 "mysql" 59 ]; 60 61 # Tests require a running MySQL instance 62 doCheck = false; 63 64 meta = with lib; { 65 description = "A MySQL driver"; 66 longDescription = '' 67 A MySQL driver that does not depend on MySQL C client libraries and 68 implements the DB API v2.0 specification. 69 ''; 70 homepage = "https://github.com/mysql/mysql-connector-python"; 71 changelog = "https://raw.githubusercontent.com/mysql/mysql-connector-python/${version}/CHANGES.txt"; 72 license = licenses.gpl2Only; 73 maintainers = with maintainers; [ neosimsim turion ]; 74 }; 75}