beekeeper-studio: add darwin support

This commit is contained in:
angel
2025-12-25 01:07:11 -08:00
parent d8653af6b7
commit 8a9e00572b
2 changed files with 45 additions and 20 deletions
+39 -14
View File
@@ -3,8 +3,10 @@
stdenv,
fetchurl,
dpkg,
unzip,
autoPatchelfHook,
makeWrapper,
runtimeShell,
glibc,
gcc,
glib,
@@ -36,26 +38,32 @@ stdenv.mkDerivation (finalAttrs: {
src =
let
selectSystem = attrs: attrs.${stdenv.hostPlatform.system};
arch = selectSystem {
x86_64-linux = "amd64";
aarch64-linux = "arm64";
asset = selectSystem {
x86_64-linux = "beekeeper-studio_${finalAttrs.version}_amd64.deb";
aarch64-linux = "beekeeper-studio_${finalAttrs.version}_arm64.deb";
x86_64-darwin = "Beekeeper-Studio-${finalAttrs.version}-mac.zip";
aarch64-darwin = "Beekeeper-Studio-${finalAttrs.version}-arm64-mac.zip";
};
in
fetchurl {
url = "https://github.com/beekeeper-studio/beekeeper-studio/releases/download/v${finalAttrs.version}/beekeeper-studio_${finalAttrs.version}_${arch}.deb";
url = "https://github.com/beekeeper-studio/beekeeper-studio/releases/download/v${finalAttrs.version}/${asset}";
hash = selectSystem {
x86_64-linux = "sha256-JSgZ/rDR3d2aKWuclE9tB5538fcMSShjx9gkzkp/7GA=";
aarch64-linux = "sha256-RsBw4jXcTA2WS1eMleAdljdw8ur0kf2WoQW3dNol2FA=";
x86_64-darwin = "sha256-jeduEmtBET/sFMnTJrtgQixXfJdwePBFjDzdOH0l/Zc=";
aarch64-darwin = "sha256-s+1asaVaVLDlkanp93u/qMdbq5Kde7/fFdzfJ+O6H9E=";
};
};
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
];
nativeBuildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
dpkg
autoPatchelfHook
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ unzip ];
buildInputs = [
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
(lib.getLib stdenv.cc.cc)
xorg.libX11
xorg.libXcomposite
@@ -86,11 +94,12 @@ stdenv.mkDerivation (finalAttrs: {
krb5
];
runtimeDependencies = map lib.getLib [ systemd ];
runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux (lib.getLib systemd);
installPhase = ''
runHook preInstall
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
cp -r usr $out
substituteInPlace $out/share/applications/beekeeper-studio.desktop \
--replace-fail '"/opt/Beekeeper Studio/beekeeper-studio"' "beekeeper-studio"
@@ -98,11 +107,24 @@ stdenv.mkDerivation (finalAttrs: {
cp -r opt/"Beekeeper Studio" $out/opt/beekeeper-studio
makeWrapper $out/opt/beekeeper-studio/beekeeper-studio-bin $out/bin/beekeeper-studio \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$out/Applications" "$out/bin"
cp -R . "$out/Applications/Beekeeper Studio.app"
# Create a launcher script to run from the command line
cat > "$out/bin/beekeeper-studio" << EOF
#!${runtimeShell}
open -na "$out/Applications/Beekeeper Studio.app" --args "\$@"
EOF
chmod +x "$out/bin/beekeeper-studio"
''
+ ''
runHook postInstall
'';
preFixup = ''
dontFixup = stdenv.hostPlatform.isDarwin;
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --add-needed libGL.so.1 \
--add-needed libEGL.so.1 \
--add-rpath ${
@@ -124,10 +146,13 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with lib.maintainers; [
milogert
alexnortung
iamanaws
];
platforms = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
knownVulnerabilities = [ "Electron version 31 is EOL" ];
};
+6 -6
View File
@@ -3,11 +3,8 @@
set -eou pipefail
PACKAGE_DIR=$(realpath $(dirname $0))
latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/beekeeper-studio/beekeeper-studio/releases/latest | jq --raw-output .tag_name | sed 's/^v//')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; beekeeper-studio.version or (lib.getVersion beekeeper-studio)" | tr -d '"')
currentVersion=$(nix eval --raw -f . beekeeper-studio.version)
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "package is up-to-date: $currentVersion"
@@ -16,5 +13,8 @@ fi
nix-update beekeeper-studio --version "$latestVersion" || true
hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url "$(nix eval -f . --raw beekeeper-studio.src.url --system aarch64-linux)"))
update-source-version beekeeper-studio $latestVersion $hash --system=aarch64-linux --ignore-same-version
systems=$(nix eval --json -f . beekeeper-studio.meta.platforms | jq --raw-output '.[]')
for system in $systems; do
hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix eval --raw -f . beekeeper-studio.src.url --system "$system")))
update-source-version beekeeper-studio $latestVersion $hash --system=$system --ignore-same-version --ignore-same-hash
done