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