blob: 629482dc9051758c37423ee6297be97ada922f2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
{
stdenv,
lib,
fetchurl,
autoPatchelfHook,
libxcrypt-legacy,
makeBinaryWrapper,
pgsql-tools,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pgsql-tools";
version = "2.1.0";
src = fetchurl (
let
sources = {
x86_64-linux = {
url = "https://github.com/microsoft/pgsql-tools/releases/download/v${finalAttrs.version}/pgsqltoolsservice-linux-x64.tar.gz";
hash = "sha256-dN7+LJCUwb39ypuJV4p3jUHNGAPaObN4aZvsOHIpmkQ=";
};
aarch64-linux = {
url = "https://github.com/microsoft/pgsql-tools/releases/download/v${finalAttrs.version}/pgsqltoolsservice-linux-arm64.tar.gz";
hash = "sha256-rD8jymGdM1RDGDbrKu6E7xoWtSMRNuc2ngCmR+sHgQI=";
};
aarch64-darwin = {
url = "https://github.com/microsoft/pgsql-tools/releases/download/v${finalAttrs.version}/pgsqltoolsservice-osx-arm64.tar.gz";
hash = "sha256-tpabEKB1kqse7D58FsP/9jywk+vgAAvptL9MadwxWg8=";
};
};
in
sources.${stdenv.hostPlatform.system}
);
nativeBuildInputs = [
makeBinaryWrapper
]
++ lib.optionals stdenv.hostPlatform.isLinux [
autoPatchelfHook
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
libxcrypt-legacy
(lib.getLib stdenv.cc.cc)
];
dontBuild = true;
dontStrip = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib/pgsql-tools
install -Dm755 ossdbtoolsservice_main $out/lib/pgsql-tools/ossdbtoolsservice_main
cp -r _internal $out/lib/pgsql-tools/
makeBinaryWrapper $out/lib/pgsql-tools/ossdbtoolsservice_main $out/bin/ossdbtoolsservice_main \
${lib.optionalString stdenv.hostPlatform.isLinux ''--prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
libxcrypt-legacy
(lib.getLib stdenv.cc.cc)
]
}"''} \
--chdir $out/lib/pgsql-tools
runHook postInstall
'';
doInstallCheck = true;
passthru = {
updateScript = ./update.sh;
};
meta = {
homepage = "https://github.com/microsoft/pgsql-tools";
description = "Backend service for PostgreSQL server tools, offering features such as connection management, query execution with result set handling, and language service support via the VS Code protocol";
changelog = "https://github.com/microsoft/pgsql-tools/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
maintainers = with lib.maintainers; [ liberodark ];
mainProgram = "ossdbtoolsservice_main";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
|