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