From 1bac715b6c3b277524bad2155e2b85a58cd71dbe Mon Sep 17 00:00:00 2001 From: Rhydian Jenkins Date: Thu, 6 Nov 2025 19:02:11 +0000 Subject: [PATCH] tableplus: add linux support --- pkgs/by-name/ta/tableplus/darwin.nix | 38 ++++++++++++++ pkgs/by-name/ta/tableplus/linux.nix | 74 +++++++++++++++++++++++++++ pkgs/by-name/ta/tableplus/package.nix | 41 +++------------ 3 files changed, 119 insertions(+), 34 deletions(-) create mode 100644 pkgs/by-name/ta/tableplus/darwin.nix create mode 100644 pkgs/by-name/ta/tableplus/linux.nix diff --git a/pkgs/by-name/ta/tableplus/darwin.nix b/pkgs/by-name/ta/tableplus/darwin.nix new file mode 100644 index 000000000000..3326898505e0 --- /dev/null +++ b/pkgs/by-name/ta/tableplus/darwin.nix @@ -0,0 +1,38 @@ +{ + lib, + fetchurl, + _7zz, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "tableplus"; + version = "538"; + src = fetchurl { + url = "https://download.tableplus.com/macos/${finalAttrs.version}/TablePlus.dmg"; + hash = "sha256-db3dvjEzkqWrEO+lXyImk0cVBkh8MnCwHOYKIg+kRC4="; + }; + + sourceRoot = "TablePlus.app"; + + nativeBuildInputs = [ _7zz ]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/Applications/TablePlus.app" + cp -R . "$out/Applications/TablePlus.app" + mkdir "$out/bin" + ln -s "$out/Applications/TablePlus.app/Contents/MacOS/TablePlus" "$out/bin/${finalAttrs.pname}" + + runHook postInstall + ''; + + meta = { + description = "Database management made easy"; + homepage = "https://tableplus.com"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ yamashitax ]; + platforms = lib.platforms.darwin; + }; +}) diff --git a/pkgs/by-name/ta/tableplus/linux.nix b/pkgs/by-name/ta/tableplus/linux.nix new file mode 100644 index 000000000000..7d5e1f3fdaee --- /dev/null +++ b/pkgs/by-name/ta/tableplus/linux.nix @@ -0,0 +1,74 @@ +{ + autoPatchelfHook, + dpkg, + fetchurl, + gtk3, + gtksourceview3, + krb5, + lib, + libgee, + libsecret, + libxkbcommon, + stdenv, + wrapGAppsHook3, + xorg, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "tableplus"; + version = "0.1.284"; + + src = fetchurl { + url = "https://web.archive.org/web/20251230232124/https://deb.tableplus.com/debian/22/pool/main/t/tableplus/tableplus_${finalAttrs.version}_amd64.deb"; + hash = "sha256-TrYRRpjSVRD721XEd0gwGPv4RNq/uwaswPW2J8oVjXQ="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + dpkg + wrapGAppsHook3 + ]; + + buildInputs = [ + gtk3 + gtksourceview3 + krb5 + libgee + libsecret + libxkbcommon + xorg.libX11 + xorg.libXcursor + xorg.libXext + xorg.libXi + xorg.libXrandr + xorg.libXrender + xorg.libxcb + ]; + + unpackPhase = '' + dpkg-deb -x $src . + ''; + + installPhase = '' + runHook preInstall + + substituteInPlace opt/tableplus/tableplus.desktop \ + --replace-fail "Exec=/usr/local/bin/tableplus" "Exec=tableplus" \ + --replace-fail "Icon=/opt/tableplus/resource/image/logo.png" "Icon=tableplus" + install -Dt $out/bin opt/tableplus/tableplus + install -Dt $out/share/applications/ opt/tableplus/tableplus.desktop + install -Dt $out/share/icons/hicolor/256x256/apps/ opt/tableplus/resource/image/tableplus.png + + runHook postInstall + ''; + + meta = { + description = "Database management made easy"; + homepage = "https://tableplus.com"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ rhydianjenkins ]; + platforms = lib.platforms.linux; + mainProgram = "tableplus"; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}) diff --git a/pkgs/by-name/ta/tableplus/package.nix b/pkgs/by-name/ta/tableplus/package.nix index 3326898505e0..7bb06016e0de 100644 --- a/pkgs/by-name/ta/tableplus/package.nix +++ b/pkgs/by-name/ta/tableplus/package.nix @@ -1,38 +1,11 @@ { - lib, - fetchurl, - _7zz, + callPackage, stdenv, }: -stdenv.mkDerivation (finalAttrs: { - pname = "tableplus"; - version = "538"; - src = fetchurl { - url = "https://download.tableplus.com/macos/${finalAttrs.version}/TablePlus.dmg"; - hash = "sha256-db3dvjEzkqWrEO+lXyImk0cVBkh8MnCwHOYKIg+kRC4="; - }; - - sourceRoot = "TablePlus.app"; - - nativeBuildInputs = [ _7zz ]; - - installPhase = '' - runHook preInstall - - mkdir -p "$out/Applications/TablePlus.app" - cp -R . "$out/Applications/TablePlus.app" - mkdir "$out/bin" - ln -s "$out/Applications/TablePlus.app/Contents/MacOS/TablePlus" "$out/bin/${finalAttrs.pname}" - - runHook postInstall - ''; - - meta = { - description = "Database management made easy"; - homepage = "https://tableplus.com"; - license = lib.licenses.unfree; - maintainers = with lib.maintainers; [ yamashitax ]; - platforms = lib.platforms.darwin; - }; -}) +if stdenv.hostPlatform.isDarwin then + callPackage ./darwin.nix { } +else if stdenv.hostPlatform.isLinux then + callPackage ./linux.nix { } +else + throw "Unsupported platform: ${stdenv.hostPlatform.system}"