python312Packages.types-aiobotocore: 2.15.2 -> 2.15.2.post3 (#361801)
[NixPkgs.git] / pkgs / by-name / db / dbeaver-bin / package.nix
blobc9cc555799860a96c725a0ad4c4a730149a9e1a4
2   lib,
3   stdenvNoCC,
4   fetchurl,
5   undmg,
6   makeWrapper,
7   openjdk17,
8   gnused,
9   autoPatchelfHook,
10   wrapGAppsHook3,
11   gtk3,
12   glib,
13   webkitgtk_4_0,
14   glib-networking,
15   override_xmx ? "1024m",
18 stdenvNoCC.mkDerivation (finalAttrs: {
19   pname = "dbeaver-bin";
20   version = "24.2.3";
22   src =
23     let
24       inherit (stdenvNoCC.hostPlatform) system;
25       selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
26       suffix = selectSystem {
27         x86_64-linux = "linux.gtk.x86_64-nojdk.tar.gz";
28         aarch64-linux = "linux.gtk.aarch64-nojdk.tar.gz";
29         x86_64-darwin = "macos-x86_64.dmg";
30         aarch64-darwin = "macos-aarch64.dmg";
31       };
32       hash = selectSystem {
33         x86_64-linux = "sha256-TvDpoEcnZBS8ORggFwLM80FXsJ8EXKvRSPUn+VtNTk8=";
34         aarch64-linux = "sha256-59khU3VQzpNeZv69pbeeE4ZAFajyI5gUUw9baOWPIFM=";
35         x86_64-darwin = "sha256-/YyN5daeoxq0oii6qYRpZ8cb43u6n8HuVc2JqVOhrxs=";
36         aarch64-darwin = "sha256-Stb76QpLnpmpBYDm+6fgkcx+TlY8hVkNtvGgdMWbaHg=";
37       };
38     in
39     fetchurl {
40       url = "https://github.com/dbeaver/dbeaver/releases/download/${finalAttrs.version}/dbeaver-ce-${finalAttrs.version}-${suffix}";
41       inherit hash;
42     };
44   sourceRoot = lib.optional stdenvNoCC.hostPlatform.isDarwin "DBeaver.app";
46   nativeBuildInputs =
47     [ makeWrapper ]
48     ++ lib.optionals (!stdenvNoCC.hostPlatform.isDarwin) [
49       gnused
50       wrapGAppsHook3
51       autoPatchelfHook
52     ]
53     ++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ undmg ];
55   dontConfigure = true;
56   dontBuild = true;
58   prePatch = ''
59     substituteInPlace ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}dbeaver.ini \
60       --replace-fail '-Xmx1024m' '-Xmx${override_xmx}'
61   '';
63   installPhase =
64     if !stdenvNoCC.hostPlatform.isDarwin then
65       ''
66         runHook preInstall
68         mkdir -p $out/opt/dbeaver $out/bin
69         cp -r * $out/opt/dbeaver
70         makeWrapper $out/opt/dbeaver/dbeaver $out/bin/dbeaver \
71           --prefix PATH : "${openjdk17}/bin" \
72           --set JAVA_HOME "${openjdk17.home}" \
73           --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
74           --prefix LD_LIBRARY_PATH : "$out/lib:${
75             lib.makeLibraryPath [
76               gtk3
77               glib
78               webkitgtk_4_0
79               glib-networking
80             ]
81           }"
83         mkdir -p $out/share/icons/hicolor/256x256/apps
84         ln -s $out/opt/dbeaver/dbeaver.png $out/share/icons/hicolor/256x256/apps/dbeaver.png
86         mkdir -p $out/share/applications
87         ln -s $out/opt/dbeaver/dbeaver-ce.desktop $out/share/applications/dbeaver.desktop
89         substituteInPlace $out/opt/dbeaver/dbeaver-ce.desktop \
90           --replace-fail "/usr/share/dbeaver-ce/dbeaver.png" "dbeaver" \
91           --replace-fail "/usr/share/dbeaver-ce/dbeaver" "$out/bin/dbeaver"
93         sed -i '/^Path=/d' $out/share/applications/dbeaver.desktop
95         runHook postInstall
96       ''
97     else
98       ''
99         runHook preInstall
101         mkdir -p $out/{Applications/dbeaver.app,bin}
102         cp -R . $out/Applications/dbeaver.app
103         makeWrapper $out/{Applications/dbeaver.app/Contents/MacOS,bin}/dbeaver \
104           --prefix PATH : "${openjdk17}/bin" \
105           --set JAVA_HOME "${openjdk17.home}"
107         runHook postInstall
108       '';
110   passthru.updateScript = ./update.sh;
112   meta = with lib; {
113     homepage = "https://dbeaver.io/";
114     description = "Universal SQL Client for developers, DBA and analysts. Supports MySQL, PostgreSQL, MariaDB, SQLite, and more";
115     longDescription = ''
116       Free multi-platform database tool for developers, SQL programmers, database
117       administrators and analysts. Supports all popular databases: MySQL,
118       PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access,
119       Teradata, Firebird, Derby, etc.
120     '';
121     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
122     license = licenses.asl20;
123     platforms = platforms.linux ++ platforms.darwin;
124     maintainers = with maintainers; [
125       gepbird
126       mkg20001
127       yzx9
128     ];
129     mainProgram = "dbeaver";
130   };