Files
nixpkgs/pkgs/by-name/db/dbgate/package.nix
2026-08-05 23:22:33 +00:00

92 lines
2.3 KiB
Nix

{
lib,
stdenv,
appimageTools,
fetchurl,
_7zz,
}:
let
pname = "dbgate";
version = "7.2.4";
src =
fetchurl
{
aarch64-linux = {
url = "https://github.com/dbgate/dbgate/releases/download/v${version}/dbgate-${version}-linux_arm64.AppImage";
hash = "sha256-9X8AyFcKy94blybAEU/H83Ku5oFQU4piVtCTNn4mobE=";
};
x86_64-linux = {
url = "https://github.com/dbgate/dbgate/releases/download/v${version}/dbgate-${version}-linux_x86_64.AppImage";
hash = "sha256-v3HPdY5so4IYY8tfk5mqjKOglCvcKk7uKYHV51DoiLM=";
};
aarch64-darwin = {
url = "https://github.com/dbgate/dbgate/releases/download/v${version}/dbgate-${version}-mac_universal.dmg";
hash = "sha256-GPdDglP2DVGCdchvj1Q5oLU3+DSzTccUbH5LmHGRj/M=";
};
}
.${stdenv.hostPlatform.system} or (throw "dbgate: ${stdenv.hostPlatform.system} is unsupported.");
passthru.updateScript = ./update.sh;
meta = {
description = "Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others";
homepage = "https://dbgate.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ luftmensch-luftmensch ];
changelog = "https://github.com/dbgate/dbgate/releases/tag/v${version}";
mainProgram = "dbgate";
platforms = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
in
if stdenv.hostPlatform.isDarwin then
stdenv.mkDerivation {
inherit
pname
version
src
passthru
meta
;
sourceRoot = ".";
nativeBuildInputs = [ _7zz ];
unpackPhase = "7zz x ${src}";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
}
else
let
appimageContents = appimageTools.extract { inherit pname src version; };
in
appimageTools.wrapType2 {
inherit
pname
version
src
passthru
meta
;
extraInstallCommands = ''
install -Dm644 ${appimageContents}/dbgate.desktop -t $out/share/applications
substituteInPlace $out/share/applications/dbgate.desktop \
--replace-warn "Exec=AppRun --no-sandbox" "Exec=dbgate"
cp -r ${appimageContents}/usr/share/icons $out/share
'';
}