summary refs log tree commit diff
path: root/pkgs/development/libraries/unixODBCDrivers
diff options
context:
space:
mode:
authorJulien Debon <julien.debon@tweag.io>2022-01-26 11:31:17 +0100
committerJulien Debon <julien.debon@tweag.io>2022-04-11 07:58:17 +0200
commit6bfb28f90db9e022491f05fc9f6c6457d5468b38 (patch)
tree9b5061d141250af62697e51335b2c3e067359bab /pkgs/development/libraries/unixODBCDrivers
parent5af2704214270c4475f6a6de2735ae64822d39e9 (diff)
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.
Diffstat (limited to 'pkgs/development/libraries/unixODBCDrivers')
-rw-r--r--pkgs/development/libraries/unixODBCDrivers/default.nix49
1 files changed, 46 insertions, 3 deletions
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 ];
+    };
+  };
 }