blob: 5eb7651f199b9ffbd7f35cf974ddc96511c84200 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# To enable specific database drivers, override this derivation and pass the
# driver packages in the drivers argument (e.g. mysql_jdbc, postgresql_jdbc).
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, unzip
, jre
, drivers ? []
}:
let
version = "3.9.1";
in stdenv.mkDerivation rec {
name = "squirrel-sql-${version}";
src = fetchurl {
url = "mirror://sourceforge/project/squirrel-sql/1-stable/${version}-plainzip/squirrelsql-${version}-standard.zip";
sha256 = "1xpkh9kwdjzd0zks8c4mq3add9ivc24hb0hflp11dl32dsdmzrai";
};
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ jre ];
unpackPhase = ''
runHook preUnpack
unzip ${src}
runHook postUnpack
'';
buildPhase = ''
runHook preBuild
cd squirrelsql-${version}-standard
chmod +x squirrel-sql.sh
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/squirrel-sql
cp -r . $out/share/squirrel-sql
mkdir -p $out/bin
cp=""
for pkg in ${builtins.concatStringsSep " " drivers}; do
if test -n "$cp"; then
cp="$cp:"
fi
cp="$cp"$(echo $pkg/share/java/*.jar | tr ' ' :)
done
makeWrapper $out/share/squirrel-sql/squirrel-sql.sh $out/bin/squirrel-sql \
--set CLASSPATH "$cp" \
--set JAVA_HOME "${jre}"
# Make sure above `CLASSPATH` gets picked up
substituteInPlace $out/share/squirrel-sql/squirrel-sql.sh --replace "-cp \"\$CP\"" "-cp \"\$CLASSPATH:\$CP\""
mkdir -p $out/share/icons/hicolor/32x32/apps
ln -s $out/share/squirrel-sql/icons/acorn.png \
$out/share/icons/hicolor/32x32/apps/squirrel-sql.png
ln -s ${desktopItem}/share/applications $out/share
runHook postInstall
'';
desktopItem = makeDesktopItem {
name = "squirrel-sql";
exec = "squirrel-sql";
comment = meta.description;
desktopName = "SQuirreL SQL";
genericName = "SQL Client";
categories = "Development;";
icon = "squirrel-sql";
};
meta = with stdenv.lib; {
description = "Universal SQL Client";
homepage = http://squirrel-sql.sourceforge.net/;
license = licenses.lgpl21;
platforms = platforms.linux;
maintainers = with maintainers; [ khumba ];
};
}
|