13 assert odbcSupport -> unixODBC != null;
16 inherit (lib) optional optionals optionalString;
18 throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
20 # assemble list of components
21 components = [ "basic" "sdk" "sqlplus" "tools" ] ++ optional odbcSupport "odbc";
23 # determine the version number, there might be different ones per architecture
25 x86_64-linux = "19.16.0.0.0";
26 aarch64-linux = "19.10.0.0.0";
27 x86_64-darwin = "19.3.0.0.0";
28 }.${stdenv.hostPlatform.system} or throwSystem;
31 x86_64-linux = "1916000";
32 aarch64-linux = "191000";
33 x86_64-darwin = "193000";
34 }.${stdenv.hostPlatform.system} or throwSystem;
36 # hashes per component and architecture
39 basic = "sha256-Sq1rWvbC1YME7EjSYPaP2g+1Xxxkk4ZkGaBmLo2cKcQ=";
40 sdk = "sha256-yJ8f/Hlq6vZoPxv+dfY4z1E7rWvcqlK+ou0SU0KKlEI=";
41 sqlplus = "sha256-C44srukpCB9et9UWm59daJmU83zr0HAktnWv7R42Irw=";
42 tools = "sha256-GP4E1REIoU3lctVYmLsAiwTJEvGRpCmOFlRuZk+A8HE=";
43 odbc = "sha256-JECxK7Ia1IJtve2goZJdTkvm5NJjqB2rc6k5BXUt3oA=";
46 basic = "sha256-DNntH20BAmo5kOz7uEgW2NXaNfwdvJ8l8oMnp50BOsY=";
47 sdk = "sha256-8VpkNyLyFMUfQwbZpSDV/CB95RoXfaMr8w58cRt/syw=";
48 sqlplus = "sha256-iHcyijHhAvjsAqN9R+Rxo2R47k940VvPbScc2MWYn0Q=";
49 tools = "sha256-4QY0EwcnctwPm6ZGDZLudOFM4UycLFmRIluKGXVwR0M=";
50 odbc = "sha256-T+RIIKzZ9xEg/E72pfs5xqHz2WuIWKx/oRfDrQbw3ms=";
53 basic = "f4335c1d53e8188a3a8cdfb97494ff87c4d0f481309284cf086dc64080a60abd";
54 sdk = "b46b4b87af593f7cfe447cfb903d1ae5073cec34049143ad8cdc9f3e78b23b27";
55 sqlplus = "f7565c3cbf898b0a7953fbb0017c5edd9d11d1863781588b7caf3a69937a2e9e";
56 tools = "b2bc474f98da13efdbc77fd05f559498cd8c08582c5b9038f6a862215de33f2c";
57 odbc = "f91da40684abaa866aa059eb26b1322f2d527670a1937d678404c991eadeb725";
59 }.${stdenv.hostPlatform.system} or throwSystem;
61 # rels per component and architecture, optional
62 rels = { }.${stdenv.hostPlatform.system} or { };
64 # convert platform to oracle architecture names
66 x86_64-linux = "linux.x64";
67 aarch64-linux = "linux.arm64";
68 x86_64-darwin = "macos.x64";
69 }.${stdenv.hostPlatform.system} or throwSystem;
72 x86_64-linux = "linux";
73 aarch64-linux = "linux";
74 x86_64-darwin = "mac";
75 }.${stdenv.hostPlatform.system} or throwSystem;
77 # calculate the filename of a single zip file
78 srcFilename = component: arch: version: rel:
79 "instantclient-${component}-${arch}-${version}" +
80 (optionalString (rel != "") "-${rel}") +
81 "dbru.zip"; # ¯\_(ツ)_/¯
83 # fetcher for the non clickthrough artifacts
84 fetcher = srcFilename: hash: fetchurl {
85 url = "https://download.oracle.com/otn_software/${shortArch}/instantclient/${directory}/${srcFilename}";
92 (fetcher (srcFilename component arch version rels.${component} or "") hashes.${component} or ""))
95 pname = "oracle-instantclient";
96 extLib = stdenv.hostPlatform.extensions.sharedLibrary;
99 inherit pname version srcs;
101 buildInputs = [ stdenv.cc.cc.lib ]
102 ++ optional stdenv.isLinux libaio
103 ++ optional odbcSupport unixODBC;
105 nativeBuildInputs = [ makeWrapper unzip ]
106 ++ optional stdenv.isLinux autoPatchelfHook
107 ++ optional stdenv.isDarwin fixDarwinDylibNames;
109 outputs = [ "out" "dev" "lib" ];
111 unpackCmd = "unzip $curSrc";
114 mkdir -p "$out/"{bin,include,lib,"share/java","share/${pname}-${version}/demo/"} $lib/lib
115 install -Dm755 {adrci,genezi,uidrvci,sqlplus,exp,expdp,imp,impdp} $out/bin
117 # cp to preserve symlinks
118 cp -P *${extLib}* $lib/lib
120 install -Dm644 *.jar $out/share/java
121 install -Dm644 sdk/include/* $out/include
122 install -Dm644 sdk/demo/* $out/share/${pname}-${version}/demo
125 ln -sfn $out/bin/sqlplus $out/bin/sqlplus64
128 postFixup = optionalString stdenv.isDarwin ''
129 for exe in "$out/bin/"* ; do
130 if [ ! -L "$exe" ]; then
131 install_name_tool -add_rpath "$lib/lib" "$exe"
137 description = "Oracle instant client libraries and sqlplus CLI";
139 Oracle instant client provides access to Oracle databases (OCI,
140 OCCI, Pro*C, ODBC or JDBC). This package includes the sqlplus
141 command line SQL client.
143 sourceProvenance = with sourceTypes; [ binaryBytecode ];
144 license = licenses.unfree;
145 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
146 maintainers = with maintainers; [ flokli ];
147 hydraPlatforms = [ ];