2020-04-24 23:36:52 +00:00
|
|
|
# To enable specific database drivers, override this derivation and pass the
|
|
|
|
# driver packages in the drivers argument (e.g. mysql_jdbc, postgresql_jdbc).
|
2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeDesktopItem, makeWrapper, unzip
|
2020-04-24 23:36:52 +00:00
|
|
|
, jre
|
|
|
|
, drivers ? []
|
|
|
|
}:
|
2021-07-18 21:22:44 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "squirrel-sql";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "4.5.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/project/squirrel-sql/1-stable/${version}-plainzip/squirrelsql-${version}-standard.zip";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-LKX8yNSLs60546ZcvLlQF3e++VxHmPsczui4cfrpia0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "squirrel-sql";
|
|
|
|
exec = "squirrel-sql";
|
|
|
|
comment = meta.description;
|
|
|
|
desktopName = "SQuirreL SQL";
|
|
|
|
genericName = "SQL Client";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Development" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
icon = "squirrel-sql";
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Universal SQL Client";
|
|
|
|
homepage = "http://squirrel-sql.sourceforge.net/";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2022-02-21 08:47:16 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ khumba ];
|
|
|
|
};
|
|
|
|
}
|