1{ lib, stdenv, makeWrapper, requireFile, unzip, jdk }:
2
3let
4 version = "22.4.0.342.1212";
5 fileVersion = "1032835-01";
6in
7 stdenv.mkDerivation {
8
9 inherit version;
10 pname = "sqlcl";
11
12 src = requireFile rec {
13 url = "https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/";
14 name = "V${fileVersion}.zip";
15 message = ''
16 This Nix expression requires that ${name} already be part of the store. To
17 obtain it you need to
18
19 - navigate to ${url}
20 - make sure that it says "Version ${version}" above the list of downloads
21 - if it does not, click on the "Previous Version" link below the
22 download and repeat until the version is correct. This is necessary
23 because as the time of this writing there exists no permanent link
24 for the current version yet.
25 Also consider updating this package yourself (you probably just need
26 to change the `version` variable and update the sha256 to the one of
27 the new file) or opening an issue at the nixpkgs repo.
28 - click "Download"
29 - sign in or create an oracle account if neccessary
30 - on the next page, click the "${name}" link
31
32 and then add the file to the Nix store using either:
33
34 nix-store --add-fixed sha256 ${name}
35
36 or
37
38 nix-prefetch-url --type sha256 file:///path/to/${name}
39 '';
40 sha256 = "0i4xsj502s465fgmlcqn80r8rqzr11mv74x9fzrlbqmkkh5c782k";
41 };
42
43 nativeBuildInputs = [ makeWrapper unzip ];
44
45 unpackCmd = "unzip $curSrc";
46
47 installPhase = ''
48 mkdir -p $out/libexec
49 mv * $out/libexec/
50
51 makeWrapper $out/libexec/bin/sql $out/bin/sqlcl \
52 --set JAVA_HOME ${jdk.home} \
53 --chdir "$out/libexec/bin"
54 '';
55
56 meta = with lib; {
57 description = "Oracle's Oracle DB CLI client";
58 longDescription = ''
59 Oracle SQL Developer Command Line (SQLcl) is a free command line
60 interface for Oracle Database. It allows you to interactively or batch
61 execute SQL and PL/SQL. SQLcl provides in-line editing, statement
62 completion, and command recall for a feature-rich experience, all while
63 also supporting your previously written SQL*Plus scripts.
64 '';
65 homepage = "https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/";
66 license = licenses.unfree;
67 platforms = [ "x86_64-linux" ];
68 maintainers = with maintainers; [ misterio77 ];
69 };
70}