From cb4e3cca2e3fc99c0b49ac971ced7a295f40e015 Mon Sep 17 00:00:00 2001 From: Zexin Yuan Date: Mon, 30 Jun 2025 21:49:27 +0800 Subject: [PATCH] dbeaver-bin: remove bundled jre on darwin --- pkgs/by-name/db/dbeaver-bin/package.nix | 33 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/db/dbeaver-bin/package.nix b/pkgs/by-name/db/dbeaver-bin/package.nix index 56ac135ba770..8fa92b2ef459 100644 --- a/pkgs/by-name/db/dbeaver-bin/package.nix +++ b/pkgs/by-name/db/dbeaver-bin/package.nix @@ -55,18 +55,29 @@ stdenvNoCC.mkDerivation (finalAttrs: { dontConfigure = true; dontBuild = true; - prePatch = '' - substituteInPlace ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}dbeaver.ini \ - --replace-fail '-Xmx1024m' '-Xmx${override_xmx}' - ''; + prePatch = + '' + substituteInPlace ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}dbeaver.ini \ + --replace-fail '-Xmx1024m' '-Xmx${override_xmx}' + '' + # remove the bundled JRE configuration on Darwin + # dont use substituteInPlace here because it would match "-vmargs" + + lib.optionalString stdenvNoCC.hostPlatform.isDarwin '' + sed -i -e '/^-vm$/ { N; d; }' Contents/Eclipse/dbeaver.ini + ''; - preInstall = '' - # most directories are for different architectures, only keep what we need - shopt -s extglob - pushd ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}plugins/com.sun.jna_*/com/sun/jna/ - rm -r !(ptr|internal|linux-x86-64|linux-aarch64|darwin-x86-64|darwin-aarch64)/ - popd - ''; + preInstall = + '' + # most directories are for different architectures, only keep what we need + shopt -s extglob + pushd ${lib.optionalString stdenvNoCC.hostPlatform.isDarwin "Contents/Eclipse/"}plugins/com.sun.jna_*/com/sun/jna/ + rm -r !(ptr|internal|linux-x86-64|linux-aarch64|darwin-x86-64|darwin-aarch64)/ + popd + '' + # remove the bundled JRE on Darwin + + lib.optionalString stdenvNoCC.hostPlatform.isDarwin '' + rm -r Contents/Eclipse/jre/ + ''; installPhase = if !stdenvNoCC.hostPlatform.isDarwin then