From 6bfb28f90db9e022491f05fc9f6c6457d5468b38 Mon Sep 17 00:00:00 2001 From: Julien Debon Date: Wed, 26 Jan 2022 11:31:17 +0100 Subject: 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. --- .../libraries/unixODBCDrivers/default.nix | 49 ++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'pkgs/development/libraries/unixODBCDrivers') diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix index 9b4173a6da139..40ce639659380 100644 --- a/pkgs/development/libraries/unixODBCDrivers/default.nix +++ b/pkgs/development/libraries/unixODBCDrivers/default.nix @@ -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 ]; + }; + }; } -- cgit 1.4.1