summary refs log tree commit diff
path: root/pkgs/development/libraries/unixODBCDrivers/default.nix
blob: badcb7e661bbd431eb8f96471d4a9afe06787b7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql55, mariadb, sqlite, zlib, libxml2 }:

# I haven't done any parameter tweaking.. So the defaults provided here might be bad

{
  psql = stdenv.mkDerivation rec {
    name = "psqlodbc-${version}";
    version = "09.05.0210";

    src = fetchurl {
      url = "http://ftp.postgresql.org/pub/odbc/versions/src/${name}.tar.gz";
      sha256 = "0317zrxaiy209xzcc6b5sz6hsyiv4zm74iikp91rgz7z3ll4n4dc";
    };

    buildInputs = [ unixODBC postgresql ];

    passthru = {
      fancyName = "PostgreSQL";
      driver = "lib/psqlodbcw.so";
    };

    meta = with stdenv.lib; {
      description = "Official PostgreSQL ODBC Driver";
      homepage =  https://odbc.postgresql.org/;
      license = licenses.lgpl2;
      platforms = platforms.linux;
    };
  };

  mariadb = stdenv.mkDerivation rec {
    name = "mariadb-connector-odbc-${version}";
    version = "2.0.10";

    src = fetchurl {
      url = "https://downloads.mariadb.org/interstitial/connector-odbc-${version}/src/${name}-ga-src.tar.gz";
      sha256 = "0b6ximy0dg0xhqbrm1l7pn8hjapgpmddi67kh54h6i9cq9hqfdvz";
    };

    nativeBuildInputs = [ cmake ];
    buildInputs = [ unixODBC mariadb.connector-c ];

    cmakeFlags = [
      "-DMARIADB_INCLUDE_DIR=${mariadb.connector-c}/include/mariadb"
    ];

    passthru = {
      fancyName = "MariaDB";
      driver = "lib/libmyodbc3-3.51.12.so";
    };

    meta = with stdenv.lib; {
      description = "MariaDB ODBC database driver";
      homepage =  https://downloads.mariadb.org/connector-odbc/;
      license = licenses.gpl2;
      platforms = platforms.linux;
    };
  };

  mysql = stdenv.mkDerivation rec {
    name = "mysql-connector-odbc-${version}";
    majorVersion = "5.3";
    version = "${majorVersion}.6";

    src = fetchurl {
      url = "https://dev.mysql.com/get/Downloads/Connector-ODBC/${majorVersion}/${name}-src.tar.gz";
      sha256 = "1smi4z49i4zm7cmykjkwlxxzqvn7myngsw5bc35z6gqxmi8c55xr";
    };

    nativeBuildInputs = [ cmake ];
    buildInputs = [ unixODBC mysql55 ];

    cmakeFlags = [ "-DWITH_UNIXODBC=1" ];

    passthru = {
      fancyName = "MySQL";
      driver = "lib/libmyodbc3-3.51.12.so";
    };

    meta = with stdenv.lib; {
      description = "MariaDB ODBC database driver";
      homepage = https://dev.mysql.com/downloads/connector/odbc/;
      license = licenses.gpl2;
      platforms = platforms.linux;
      broken = true;
    };
  };

  sqlite = stdenv.mkDerivation rec {
    name = "sqlite-connector-odbc-${version}";
    version = "0.9993";
 
    src = fetchurl {
      url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
      sha256 = "0dgsj28sc7f7aprmdd0n5a1rmcx6pv7170c8dfjl0x1qsjxim6hs";
    };
 
    buildInputs = [ unixODBC sqlite zlib libxml2 ];
 
    configureFlags = [ "--with-odbc=${unixODBC}" ];
 
    installTargets = [ "install-3" ];

    # move libraries to $out/lib where they're expected to be
    postInstall = ''
      mkdir -p "$out/lib"
      mv "$out"/*.* "$out/lib"
    '';
 
    passthru = {
      fancyName = "SQLite";
      driver = "lib/libsqlite3odbc.so";
    };

    meta = with stdenv.lib; {
      description = "ODBC driver for SQLite";
      homepage = http://www.ch-werner.de/sqliteodbc;
      license = licenses.bsd2;
      platforms = platforms.linux;
      maintainers = with maintainers; [ vlstill ];
    };
  };
}