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 patches = [
33 # mysql-connector overrides MACOSX_DEPLOYMENT_TARGET to 11.
34 # This makes the installation with nixpkgs fail. I suspect, that's
35 # because stdenv.hostPlatform.darwinSdkVersion is (currently) set to
36 # 10.12. The patch reverts
37 # https://github.com/mysql/mysql-connector-python/commit/d1e89fd3d7391084cdf35b0806cb5d2a4b413654
38 ./0001-Revert-Fix-MacOS-wheels-platform-tag.patch
39 ];
40
41 nativeBuildInputs = [ mysql80 ];
42
43 propagatedBuildInputs = [
44 dnspython
45 protobuf
46 mysql80
47 openssl
48 pkgs.zstd
49 ];
50
51 pythonImportsCheck = [ "mysql" ];
52
53 # Tests require a running MySQL instance
54 doCheck = false;
55
56 meta = {
57 description = "MySQL driver";
58 longDescription = ''
59 A MySQL driver that does not depend on MySQL C client libraries and
60 implements the DB API v2.0 specification.
61 '';
62 homepage = "https://github.com/mysql/mysql-connector-python";
63 changelog = "https://raw.githubusercontent.com/mysql/mysql-connector-python/${src.tag}/CHANGES.txt";
64 license = lib.licenses.gpl2Only;
65 maintainers = with lib.maintainers; [
66 neosimsim
67 ];
68 };
69}