summary refs log tree commit diff
path: root/pkgs/development/libraries/oracle-instantclient
diff options
context:
space:
mode:
authorPaulus Esterhazy <pesterhazy@gmail.com>2015-04-21 12:25:09 +0200
committerPeter Simons <simons@cryp.to>2015-05-19 11:10:11 +0200
commit557c1401afee15975a4b7f896a7a98171570d259 (patch)
tree040dac4d88d9643a0878c5afd3caebfb83529dbe /pkgs/development/libraries/oracle-instantclient
parent76c34a9590585702c0bc75cf7f60499b6a682825 (diff)
downloadnixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar.gz
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar.bz2
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar.lz
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar.xz
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.tar.zst
nixpkgs-557c1401afee15975a4b7f896a7a98171570d259.zip
Add unfree Oracle instant client and SQLPlus CLI utility.
Diffstat (limited to 'pkgs/development/libraries/oracle-instantclient')
-rw-r--r--pkgs/development/libraries/oracle-instantclient/default.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/libraries/oracle-instantclient/default.nix b/pkgs/development/libraries/oracle-instantclient/default.nix
new file mode 100644
index 00000000000..ebb3aaeee58
--- /dev/null
+++ b/pkgs/development/libraries/oracle-instantclient/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, requireFile, libelf, gcc, glibc, patchelf, unzip, rpmextract, libaio }:
+
+let requireSource = version: part: hash: (requireFile rec {
+  name = "oracle-instantclient12.1-${part}-${version}.x86_64.rpm";
+  message = ''
+    This Nix expression requires that ${name} already
+    be part of the store. Download the file
+    manually at
+
+    http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
+
+    and add it to the Nix store with the following command:
+
+    nix-prefetch-url file://${name} ${hash} --type sha256
+'';
+  url = "http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html";
+  sha256 = hash;
+}); in stdenv.mkDerivation rec {
+  version = "12.1.0.2.0-1";
+  name = "oracle-instantclient-${version}";
+
+  srcBase = (requireSource version "basic" "f0e51e247cc3f210b950fd939ab1f696de9ca678d1eb179ba49ac73acb9a20ed");
+  srcDevel = (requireSource version "devel" "13b638882f07d6cfc06c85dc6b9eb5cac37064d3d594194b6b09d33483a08296");
+  srcSqlplus = (requireSource version "sqlplus" "16d87w1lii0ag47c8srnr7v4wfm9q4hy6gka8m3v6gp9cc065vam");
+
+  buildInputs = [ glibc patchelf rpmextract ];
+
+  buildCommand = ''
+    mkdir -p "${name}"
+    cd "${name}"
+    ${rpmextract}/bin/rpmextract "${srcBase}"
+    ${rpmextract}/bin/rpmextract "${srcDevel}"
+    ${rpmextract}/bin/rpmextract "${srcSqlplus}"
+
+    mkdir -p "$out/"{bin,include,lib,"share/${name}/demo/"}
+    mv "usr/share/oracle/12.1/client64/demo/"* "$out/share/${name}/demo/"
+    mv "usr/include/oracle/12.1/client64/"* "$out/include/"
+    mv "usr/lib/oracle/12.1/client64/lib/"* "$out/lib/"
+    mv "usr/lib/oracle/12.1/client64/bin/"* "$out/bin/"
+    ln -s "$out/bin/sqlplus" "$out/bin/sqlplus64"
+
+    for lib in $out/lib/lib*.so; do
+      test -f $lib || continue
+      chmod +x $lib
+      patchelf --force-rpath --set-rpath "$out/lib:${libaio}/lib" \
+               $lib
+    done
+
+    for exe in $out/bin/sqlplus; do
+      patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+               --force-rpath --set-rpath "$out/lib:${libaio}/lib" \
+               $exe
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Oracle instant client libraries and sqlplus CLI.";
+    longDescription = ''
+      Oracle instant client provides access to Oracle databases (OCI,
+      OCCI, Pro*C, ODBC or JDBC). This package includes the sqlplus
+      command line SQL client.
+    '';
+    license = licenses.unfree;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pesterhazy ];
+  };
+}