mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 19:21:04 +00:00
132 lines
4 KiB
Nix
132 lines
4 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
fetchurl,
|
|
undmg,
|
|
makeWrapper,
|
|
openjdk17,
|
|
gnused,
|
|
autoPatchelfHook,
|
|
wrapGAppsHook3,
|
|
gtk3,
|
|
glib,
|
|
webkitgtk_4_0,
|
|
glib-networking,
|
|
override_xmx ? "1024m",
|
|
}:
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "dbeaver-bin";
|
|
version = "24.2.3";
|
|
|
|
src =
|
|
let
|
|
inherit (stdenvNoCC.hostPlatform) system;
|
|
selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
|
|
suffix = selectSystem {
|
|
x86_64-linux = "linux.gtk.x86_64-nojdk.tar.gz";
|
|
aarch64-linux = "linux.gtk.aarch64-nojdk.tar.gz";
|
|
x86_64-darwin = "macos-x86_64.dmg";
|
|
aarch64-darwin = "macos-aarch64.dmg";
|
|
};
|
|
hash = selectSystem {
|
|
x86_64-linux = "sha256-TvDpoEcnZBS8ORggFwLM80FXsJ8EXKvRSPUn+VtNTk8=";
|
|
aarch64-linux = "sha256-59khU3VQzpNeZv69pbeeE4ZAFajyI5gUUw9baOWPIFM=";
|
|
x86_64-darwin = "sha256-/YyN5daeoxq0oii6qYRpZ8cb43u6n8HuVc2JqVOhrxs=";
|
|
aarch64-darwin = "sha256-Stb76QpLnpmpBYDm+6fgkcx+TlY8hVkNtvGgdMWbaHg=";
|
|
};
|
|
in
|
|
fetchurl {
|
|
url = "https://github.com/dbeaver/dbeaver/releases/download/${finalAttrs.version}/dbeaver-ce-${finalAttrs.version}-${suffix}";
|
|
inherit hash;
|
|
};
|
|
|
|
sourceRoot = lib.optional stdenvNoCC.hostPlatform.isDarwin "DBeaver.app";
|
|
|
|
nativeBuildInputs =
|
|
[ makeWrapper ]
|
|
++ lib.optionals (!stdenvNoCC.hostPlatform.isDarwin) [
|
|
gnused
|
|
wrapGAppsHook3
|
|
autoPatchelfHook
|
|
]
|
|
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ undmg ];
|
|
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
|
|
prePatch = ''
|
|
substituteInPlace ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}dbeaver.ini \
|
|
--replace-fail '-Xmx1024m' '-Xmx${override_xmx}'
|
|
'';
|
|
|
|
installPhase =
|
|
if !stdenvNoCC.hostPlatform.isDarwin then
|
|
''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/opt/dbeaver $out/bin
|
|
cp -r * $out/opt/dbeaver
|
|
makeWrapper $out/opt/dbeaver/dbeaver $out/bin/dbeaver \
|
|
--prefix PATH : "${openjdk17}/bin" \
|
|
--set JAVA_HOME "${openjdk17.home}" \
|
|
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
|
|
--prefix LD_LIBRARY_PATH : "$out/lib:${
|
|
lib.makeLibraryPath [
|
|
gtk3
|
|
glib
|
|
webkitgtk_4_0
|
|
glib-networking
|
|
]
|
|
}"
|
|
|
|
mkdir -p $out/share/icons/hicolor/256x256/apps
|
|
ln -s $out/opt/dbeaver/dbeaver.png $out/share/icons/hicolor/256x256/apps/dbeaver.png
|
|
|
|
mkdir -p $out/share/applications
|
|
ln -s $out/opt/dbeaver/dbeaver-ce.desktop $out/share/applications/dbeaver.desktop
|
|
|
|
substituteInPlace $out/opt/dbeaver/dbeaver-ce.desktop \
|
|
--replace-fail "/usr/share/dbeaver-ce/dbeaver.png" "dbeaver" \
|
|
--replace-fail "/usr/share/dbeaver-ce/dbeaver" "$out/bin/dbeaver"
|
|
|
|
sed -i '/^Path=/d' $out/share/applications/dbeaver.desktop
|
|
|
|
runHook postInstall
|
|
''
|
|
else
|
|
''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/{Applications/dbeaver.app,bin}
|
|
cp -R . $out/Applications/dbeaver.app
|
|
makeWrapper $out/{Applications/dbeaver.app/Contents/MacOS,bin}/dbeaver \
|
|
--prefix PATH : "${openjdk17}/bin" \
|
|
--set JAVA_HOME "${openjdk17.home}"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://dbeaver.io/";
|
|
description = "Universal SQL Client for developers, DBA and analysts. Supports MySQL, PostgreSQL, MariaDB, SQLite, and more";
|
|
longDescription = ''
|
|
Free multi-platform database tool for developers, SQL programmers, database
|
|
administrators and analysts. Supports all popular databases: MySQL,
|
|
PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access,
|
|
Teradata, Firebird, Derby, etc.
|
|
'';
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
license = licenses.asl20;
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
maintainers = with maintainers; [
|
|
gepbird
|
|
mkg20001
|
|
yzx9
|
|
];
|
|
mainProgram = "dbeaver";
|
|
};
|
|
})
|