1 { fetchurl, stdenv, unixODBC, cmake, postgresql, mariadb, sqlite, zlib, libxml2, dpkg, lib, openssl, libkrb5, libuuid, patchelf, libiconv, fetchFromGitHub }:
3 # I haven't done any parameter tweaking.. So the defaults provided here might be bad
6 psql = stdenv.mkDerivation rec {
8 version = "10.01.0000";
11 url = "http://ftp.postgresql.org/pub/odbc/versions/src/${pname}-${version}.tar.gz";
12 sha256 = "1cyams7157f3gry86x64xrplqi2vyqrq3rqka59gv4lb4rpl7jl7";
15 buildInputs = [ unixODBC postgresql ];
18 fancyName = "PostgreSQL";
19 driver = "lib/psqlodbcw.so";
23 description = "Official PostgreSQL ODBC Driver";
24 homepage = "https://odbc.postgresql.org/";
25 license = licenses.lgpl2;
26 platforms = platforms.linux;
30 mariadb = stdenv.mkDerivation rec {
31 pname = "mariadb-connector-odbc";
34 src = fetchFromGitHub {
36 repo = "mariadb-connector-odbc";
38 sha256 = "1kbz5mng9vx89cw2sx7gsvhbv4h86zwp31fr0hxqing3cwxhkfgw";
39 # this driver only seems to build correctly when built against the mariadb-connect-c subrepo
40 # (see https://github.com/NixOS/nixpkgs/issues/73258)
41 fetchSubmodules = true;
44 nativeBuildInputs = [ cmake ];
45 buildInputs = [ unixODBC openssl libiconv ];
48 # we don't want to build a .pkg
49 sed -i 's/ADD_SUBDIRECTORY(osxinstall)//g' CMakeLists.txt
54 # on darwin this defaults to ON but we want to build against unixODBC
59 fancyName = "MariaDB";
60 driver = if stdenv.isDarwin then "lib/libmaodbc.dylib" else "lib/libmaodbc.so";
64 description = "MariaDB ODBC database driver";
65 homepage = "https://downloads.mariadb.org/connector-odbc/";
66 license = licenses.gpl2;
67 platforms = platforms.linux ++ platforms.darwin;
71 mysql = stdenv.mkDerivation rec {
72 pname = "mysql-connector-odbc";
74 version = "${majorVersion}.6";
77 url = "https://dev.mysql.com/get/Downloads/Connector-ODBC/${majorVersion}/${pname}-${version}-src.tar.gz";
78 sha256 = "1smi4z49i4zm7cmykjkwlxxzqvn7myngsw5bc35z6gqxmi8c55xr";
81 nativeBuildInputs = [ cmake ];
82 buildInputs = [ unixODBC mariadb ];
84 cmakeFlags = [ "-DWITH_UNIXODBC=1" ];
88 driver = "lib/libmyodbc3-3.51.12.so";
92 description = "MariaDB ODBC database driver";
93 homepage = "https://dev.mysql.com/downloads/connector/odbc/";
94 license = licenses.gpl2;
95 platforms = platforms.linux;
100 sqlite = stdenv.mkDerivation rec {
101 pname = "sqlite-connector-odbc";
105 url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
106 sha256 = "0dgsj28sc7f7aprmdd0n5a1rmcx6pv7170c8dfjl0x1qsjxim6hs";
109 buildInputs = [ unixODBC sqlite zlib libxml2 ];
111 configureFlags = [ "--with-odbc=${unixODBC}" "--with-sqlite3=${sqlite.dev}" ];
113 installTargets = [ "install-3" ];
115 # move libraries to $out/lib where they're expected to be
118 mv "$out"/*.* "$out/lib"
122 fancyName = "SQLite";
123 driver = "lib/libsqlite3odbc.so";
127 description = "ODBC driver for SQLite";
128 homepage = "http://www.ch-werner.de/sqliteodbc";
129 license = licenses.bsd2;
130 platforms = platforms.linux;
131 maintainers = with maintainers; [ vlstill ];
135 msodbcsql17 = stdenv.mkDerivation rec {
136 pname = "msodbcsql17";
137 version = "${versionMajor}.${versionMinor}.${versionAdditional}-1";
141 versionAdditional = "1.1";
144 url = "https://packages.microsoft.com/debian/10/prod/pool/main/m/msodbcsql17/msodbcsql${versionMajor}_${version}_amd64.deb";
145 sha256 = "0vwirnp56jibm3qf0kmi4jnz1w7xfhnsfr8imr0c9hg6av4sk3a6";
148 nativeBuildInputs = [ dpkg patchelf ];
150 unpackPhase = "dpkg -x $src ./";
156 cp -r opt/microsoft/msodbcsql${versionMajor}/lib64 opt/microsoft/msodbcsql${versionMajor}/share $out/
160 patchelf --set-rpath ${lib.makeLibraryPath [ unixODBC openssl.out libkrb5 libuuid stdenv.cc.cc ]} \
161 $out/lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}
165 fancyName = "ODBC Driver 17 for SQL Server";
166 driver = "lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}";
170 description = "ODBC Driver 17 for SQL Server";
171 homepage = "https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017";
172 license = licenses.unfree;
173 platforms = platforms.linux;
174 maintainers = with maintainers; [ spencerjanssen ];