2019-11-22 18:34:32 +00:00
|
|
|
{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql, sqlite, zlib, libxml2, dpkg, lib, openssl, kerberos, libuuid, patchelf, libiconv, fetchFromGitHub }:
|
2016-04-26 19:18:01 +01:00
|
|
|
|
2008-06-12 00:03:30 +01:00
|
|
|
# I haven't done any parameter tweaking.. So the defaults provided here might be bad
|
2016-04-26 19:18:01 +01:00
|
|
|
|
2008-06-12 00:03:30 +01:00
|
|
|
{
|
2016-04-26 19:18:01 +01:00
|
|
|
psql = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "psqlodbc";
|
2018-03-18 15:07:06 +00:00
|
|
|
version = "10.01.0000";
|
2016-04-26 19:18:01 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "http://ftp.postgresql.org/pub/odbc/versions/src/${pname}-${version}.tar.gz";
|
2018-03-18 15:07:06 +00:00
|
|
|
sha256 = "1cyams7157f3gry86x64xrplqi2vyqrq3rqka59gv4lb4rpl7jl7";
|
2016-04-26 19:18:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ unixODBC postgresql ];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
fancyName = "PostgreSQL";
|
|
|
|
driver = "lib/psqlodbcw.so";
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2016-04-26 19:18:01 +01:00
|
|
|
description = "Official PostgreSQL ODBC Driver";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://odbc.postgresql.org/";
|
2016-04-26 19:18:01 +01:00
|
|
|
license = licenses.lgpl2;
|
|
|
|
platforms = platforms.linux;
|
2008-06-12 00:03:30 +01:00
|
|
|
};
|
|
|
|
};
|
2016-04-26 19:18:01 +01:00
|
|
|
|
|
|
|
mariadb = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "mariadb-connector-odbc";
|
2019-11-22 18:34:32 +00:00
|
|
|
version = "3.1.4";
|
2016-04-26 19:18:01 +01:00
|
|
|
|
2019-11-22 18:34:32 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MariaDB";
|
|
|
|
repo = "mariadb-connector-odbc";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1kbz5mng9vx89cw2sx7gsvhbv4h86zwp31fr0hxqing3cwxhkfgw";
|
|
|
|
# this driver only seems to build correctly when built against the mariadb-connect-c subrepo
|
|
|
|
# (see https://github.com/NixOS/nixpkgs/issues/73258)
|
|
|
|
fetchSubmodules = true;
|
2016-04-26 19:18:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2019-11-22 18:34:32 +00:00
|
|
|
buildInputs = [ unixODBC openssl libiconv ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# we don't want to build a .pkg
|
|
|
|
sed -i 's/ADD_SUBDIRECTORY(osxinstall)//g' CMakeLists.txt
|
|
|
|
'';
|
2016-04-26 19:18:01 +01:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2019-09-22 08:38:09 +01:00
|
|
|
"-DWITH_OPENSSL=ON"
|
2019-11-22 18:34:32 +00:00
|
|
|
# on darwin this defaults to ON but we want to build against unixODBC
|
|
|
|
"-DWITH_IODBC=OFF"
|
2016-04-26 19:18:01 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
fancyName = "MariaDB";
|
2019-11-22 18:34:32 +00:00
|
|
|
driver = if stdenv.isDarwin then "lib/libmaodbc.dylib" else "lib/libmaodbc.so";
|
2008-06-12 00:03:30 +01:00
|
|
|
};
|
2016-04-26 19:18:01 +01:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2016-04-26 19:18:01 +01:00
|
|
|
description = "MariaDB ODBC database driver";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://downloads.mariadb.org/connector-odbc/";
|
2016-04-26 19:18:01 +01:00
|
|
|
license = licenses.gpl2;
|
2019-11-22 18:34:32 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2016-04-26 19:18:01 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mysql = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "mysql-connector-odbc";
|
2016-04-26 19:18:01 +01:00
|
|
|
majorVersion = "5.3";
|
|
|
|
version = "${majorVersion}.6";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "https://dev.mysql.com/get/Downloads/Connector-ODBC/${majorVersion}/${pname}-${version}-src.tar.gz";
|
2016-04-26 19:18:01 +01:00
|
|
|
sha256 = "1smi4z49i4zm7cmykjkwlxxzqvn7myngsw5bc35z6gqxmi8c55xr";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2019-06-25 22:02:02 +01:00
|
|
|
buildInputs = [ unixODBC mysql ];
|
2016-04-26 19:18:01 +01:00
|
|
|
|
|
|
|
cmakeFlags = [ "-DWITH_UNIXODBC=1" ];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
fancyName = "MySQL";
|
|
|
|
driver = "lib/libmyodbc3-3.51.12.so";
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2016-04-26 19:18:01 +01:00
|
|
|
description = "MariaDB ODBC database driver";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://dev.mysql.com/downloads/connector/odbc/";
|
2016-04-26 19:18:01 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
broken = true;
|
2008-06-12 00:03:30 +01:00
|
|
|
};
|
|
|
|
};
|
2016-04-26 19:18:01 +01:00
|
|
|
|
|
|
|
sqlite = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "sqlite-connector-odbc";
|
2016-04-26 19:18:01 +01:00
|
|
|
version = "0.9993";
|
2019-10-30 11:34:47 +00:00
|
|
|
|
2016-04-26 19:18:01 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz";
|
|
|
|
sha256 = "0dgsj28sc7f7aprmdd0n5a1rmcx6pv7170c8dfjl0x1qsjxim6hs";
|
2008-06-12 00:03:30 +01:00
|
|
|
};
|
2019-10-30 11:34:47 +00:00
|
|
|
|
2016-04-26 19:18:01 +01:00
|
|
|
buildInputs = [ unixODBC sqlite zlib libxml2 ];
|
2019-10-30 11:34:47 +00:00
|
|
|
|
2020-06-09 06:02:30 +01:00
|
|
|
configureFlags = [ "--with-odbc=${unixODBC}" "--with-sqlite3=${sqlite.dev}" ];
|
2019-10-30 11:34:47 +00:00
|
|
|
|
2016-04-26 19:18:01 +01:00
|
|
|
installTargets = [ "install-3" ];
|
|
|
|
|
|
|
|
# move libraries to $out/lib where they're expected to be
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
mv "$out"/*.* "$out/lib"
|
|
|
|
'';
|
2019-10-30 11:34:47 +00:00
|
|
|
|
2016-04-26 19:18:01 +01:00
|
|
|
passthru = {
|
|
|
|
fancyName = "SQLite";
|
|
|
|
driver = "lib/libsqlite3odbc.so";
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2016-04-26 19:18:01 +01:00
|
|
|
description = "ODBC driver for SQLite";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.ch-werner.de/sqliteodbc";
|
2016-04-26 19:18:01 +01:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ vlstill ];
|
2008-06-12 16:54:57 +01:00
|
|
|
};
|
2016-04-26 19:18:01 +01:00
|
|
|
};
|
2018-08-02 03:46:53 +01:00
|
|
|
|
|
|
|
msodbcsql17 = stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "msodbcsql17";
|
2018-08-02 03:46:53 +01:00
|
|
|
version = "${versionMajor}.${versionMinor}.${versionAdditional}-1";
|
|
|
|
|
|
|
|
versionMajor = "17";
|
2021-01-30 23:20:24 +00:00
|
|
|
versionMinor = "7";
|
2019-08-27 23:58:20 +01:00
|
|
|
versionAdditional = "1.1";
|
2018-08-02 03:46:53 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-30 23:20:24 +00:00
|
|
|
url = "https://packages.microsoft.com/debian/10/prod/pool/main/m/msodbcsql17/msodbcsql${versionMajor}_${version}_amd64.deb";
|
|
|
|
sha256 = "0vwirnp56jibm3qf0kmi4jnz1w7xfhnsfr8imr0c9hg6av4sk3a6";
|
2018-08-02 03:46:53 +01:00
|
|
|
};
|
|
|
|
|
2019-10-21 20:04:11 +01:00
|
|
|
nativeBuildInputs = [ dpkg patchelf ];
|
2018-08-02 03:46:53 +01:00
|
|
|
|
|
|
|
unpackPhase = "dpkg -x $src ./";
|
|
|
|
buildPhase = "";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
mkdir -p $out/lib
|
|
|
|
cp -r opt/microsoft/msodbcsql${versionMajor}/lib64 opt/microsoft/msodbcsql${versionMajor}/share $out/
|
|
|
|
'';
|
|
|
|
|
2019-10-21 20:04:11 +01:00
|
|
|
postFixup = ''
|
|
|
|
patchelf --set-rpath ${lib.makeLibraryPath [ unixODBC openssl.out kerberos libuuid stdenv.cc.cc ]} \
|
|
|
|
$out/lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}
|
|
|
|
'';
|
|
|
|
|
2018-08-02 03:46:53 +01:00
|
|
|
passthru = {
|
|
|
|
fancyName = "ODBC Driver 17 for SQL Server";
|
|
|
|
driver = "lib/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}";
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2018-08-02 03:46:53 +01:00
|
|
|
description = "ODBC Driver 17 for SQL Server";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017";
|
2018-08-02 03:46:53 +01:00
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ spencerjanssen ];
|
|
|
|
};
|
|
|
|
};
|
2008-06-12 00:03:30 +01:00
|
|
|
}
|