unixODBCDrivers.redshift: init at 1.4.49.1000

Add Amazon Redshift ODBC driver.

As Amazon does not provide sources, we extract the Debian package and manually patchelf.
This commit is contained in:
Julien Debon 2022-01-26 11:31:17 +01:00
parent 5af2704214
commit 6bfb28f90d

View file

@ -21,7 +21,7 @@
meta = with lib; {
description = "Official PostgreSQL ODBC Driver";
homepage = "https://odbc.postgresql.org/";
homepage = "https://odbc.postgresql.org/";
license = licenses.lgpl2;
platforms = platforms.linux;
};
@ -62,7 +62,7 @@
meta = with lib; {
description = "MariaDB ODBC database driver";
homepage = "https://downloads.mariadb.org/connector-odbc/";
homepage = "https://downloads.mariadb.org/connector-odbc/";
license = licenses.gpl2;
platforms = platforms.linux ++ platforms.darwin;
};
@ -89,7 +89,7 @@
};
meta = with lib; {
description = "MariaDB ODBC database driver";
description = "MySQL ODBC database driver";
homepage = "https://dev.mysql.com/downloads/connector/odbc/";
license = licenses.gpl2;
platforms = platforms.linux;
@ -174,4 +174,47 @@
maintainers = with maintainers; [ spencerjanssen ];
};
};
redshift = stdenv.mkDerivation rec {
pname = "redshift-odbc";
version = "1.4.49.1000";
src = fetchurl {
url = "https://s3.amazonaws.com/redshift-downloads/drivers/odbc/${version}/AmazonRedshiftODBC-64-bit-${version}-1.x86_64.deb";
sha256 = "sha256-r5HvsZjB7+x+ClxtWoONkE1/NAbz90NbHfzxC6tf7jA=";
};
nativeBuildInputs = [ dpkg ];
unpackPhase = ''
dpkg -x $src src
cd src
'';
# `unixODBC` is loaded with `dlopen`, so `autoPatchElfHook` cannot see it, and `patchELF` phase would strip the manual patchelf. Thus:
# - Manually patchelf with `unixODCB` libraries
# - Disable automatic `patchELF` phase
installPhase = ''
mkdir -p $out/lib
cp opt/amazon/redshiftodbc/lib/64/* $out/lib
patchelf --set-rpath ${unixODBC}/lib/ $out/lib/libamazonredshiftodbc64.so
'';
dontPatchELF = true;
buildInputs = [ unixODBC ];
passthru = {
fancyName = "Amazon Redshift (x64)";
driver = "lib/libamazonredshiftodbc64.so";
};
meta = with lib; {
description = "Amazon Redshift ODBC driver";
homepage = "https://docs.aws.amazon.com/redshift/latest/mgmt/configure-odbc-connection.html";
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ sir4ur0n ];
};
};
}