2021-10-14 17:34:36 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
2023-01-09 13:28:57 +00:00
|
|
|
applyPatches,
|
2021-10-14 17:34:36 +00:00
|
|
|
fetchFromGitHub,
|
|
|
|
autoconf,
|
|
|
|
automake,
|
|
|
|
bison,
|
|
|
|
cmake,
|
|
|
|
libtool,
|
|
|
|
civetweb,
|
|
|
|
coreutils,
|
|
|
|
curl,
|
|
|
|
flex,
|
|
|
|
gnutls,
|
|
|
|
libconfig,
|
|
|
|
libdaemon,
|
|
|
|
libev,
|
|
|
|
libgcrypt,
|
|
|
|
libinjection,
|
2024-01-04 22:50:06 +00:00
|
|
|
libmicrohttpd,
|
2022-05-11 09:34:43 +00:00
|
|
|
libuuid,
|
2021-10-14 17:34:36 +00:00
|
|
|
lz4,
|
|
|
|
nlohmann_json,
|
2022-08-16 21:49:14 +00:00
|
|
|
openssl,
|
2021-10-14 17:34:36 +00:00
|
|
|
pcre,
|
|
|
|
perl,
|
2023-01-09 13:28:57 +00:00
|
|
|
python3,
|
2023-03-14 20:38:41 +00:00
|
|
|
prometheus-cpp,
|
2021-10-14 17:34:36 +00:00
|
|
|
zlib,
|
2023-01-09 13:28:57 +00:00
|
|
|
texinfo,
|
2021-10-14 17:34:36 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-31 08:25:54 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-10-14 17:34:36 +00:00
|
|
|
pname = "proxysql";
|
2024-03-05 01:34:56 +00:00
|
|
|
version = "2.6.0";
|
2021-10-14 17:34:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sysown";
|
2023-07-31 08:25:54 +00:00
|
|
|
repo = "proxysql";
|
|
|
|
rev = finalAttrs.version;
|
2024-03-05 01:34:56 +00:00
|
|
|
hash = "sha256-vFPTBSp5DPNRuhtSD34ah2074almS+jiYxBE1L9Pz6g=";
|
2021-10-14 17:34:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./makefiles.patch
|
|
|
|
./dont-phone-home.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
cmake
|
|
|
|
libtool
|
|
|
|
perl
|
2023-01-09 13:28:57 +00:00
|
|
|
python3
|
|
|
|
texinfo # for makeinfo
|
2021-10-14 17:34:36 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
bison
|
2022-08-16 21:49:14 +00:00
|
|
|
curl
|
2021-10-14 17:34:36 +00:00
|
|
|
flex
|
|
|
|
gnutls
|
|
|
|
libgcrypt
|
2022-05-11 09:34:43 +00:00
|
|
|
libuuid
|
2021-10-14 17:34:36 +00:00
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
2022-05-11 09:34:43 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-07-31 08:25:54 +00:00
|
|
|
GIT_VERSION = finalAttrs.version;
|
2021-10-14 17:34:36 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
# replace and fix some vendored dependencies
|
|
|
|
preBuild = # sh
|
|
|
|
''
|
|
|
|
pushd deps
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
function replace_dep() {
|
|
|
|
local folder="$1"
|
|
|
|
local src="$2"
|
|
|
|
local symlink="$3"
|
|
|
|
local name="$4"
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
pushd "$folder"
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
rm -rf "$symlink"
|
|
|
|
if [ -d "$src" ]; then
|
|
|
|
cp -R "$src"/. "$symlink"
|
|
|
|
chmod -R u+w "$symlink"
|
2024-12-10 19:26:33 +00:00
|
|
|
else
|
|
|
|
tar xf "$src"
|
2021-10-14 17:34:36 +00:00
|
|
|
ln -s "$name" "$symlink"
|
2024-12-10 19:26:33 +00:00
|
|
|
fi
|
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
popd
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
${lib.concatMapStringsSep "\n"
|
2024-12-10 19:26:33 +00:00
|
|
|
(
|
|
|
|
x:
|
2021-10-14 17:34:36 +00:00
|
|
|
''replace_dep "${x.f}" "${x.p.src}" "${
|
|
|
|
x.p.pname or (builtins.parseDrvName x.p.name).name
|
|
|
|
}" "${x.p.name}"''
|
2024-12-10 19:26:33 +00:00
|
|
|
)
|
|
|
|
(
|
|
|
|
map
|
|
|
|
(x: {
|
2023-01-09 13:28:57 +00:00
|
|
|
inherit (x) f;
|
|
|
|
p = x.p // {
|
2021-10-14 17:34:36 +00:00
|
|
|
src = applyPatches {
|
2023-01-09 13:28:57 +00:00
|
|
|
inherit (x.p) src patches;
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
[
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "curl";
|
|
|
|
p = curl;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "libconfig";
|
|
|
|
p = libconfig;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "libdaemon";
|
|
|
|
p = libdaemon;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "libev";
|
|
|
|
p = libev;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "libinjection";
|
|
|
|
p = libinjection;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2024-01-04 22:50:06 +00:00
|
|
|
f = "libmicrohttpd";
|
|
|
|
p = libmicrohttpd;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "libssl";
|
|
|
|
p = openssl;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "lz4";
|
2024-12-10 19:26:33 +00:00
|
|
|
p = lz4;
|
|
|
|
}
|
|
|
|
{
|
2023-01-09 13:28:57 +00:00
|
|
|
f = "pcre";
|
|
|
|
p = pcre;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
{
|
2023-03-14 20:38:41 +00:00
|
|
|
f = "prometheus-cpp";
|
|
|
|
p = prometheus-cpp;
|
2024-12-10 19:26:33 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
pushd libhttpserver
|
|
|
|
tar xf libhttpserver-*.tar.gz
|
|
|
|
sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac
|
2024-12-10 19:26:33 +00:00
|
|
|
popd
|
2021-10-14 17:34:36 +00:00
|
|
|
|
|
|
|
pushd json
|
|
|
|
rm json.hpp
|
|
|
|
ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp .
|
|
|
|
popd
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-01-09 13:28:57 +00:00
|
|
|
pushd prometheus-cpp/prometheus-cpp/3rdparty
|
|
|
|
replace_dep . "${civetweb.src}" civetweb
|
|
|
|
popd
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-01-09 13:28:57 +00:00
|
|
|
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2024-01-04 22:50:06 +00:00
|
|
|
pushd libmicrohttpd/libmicrohttpd
|
2021-10-14 17:34:36 +00:00
|
|
|
autoreconf
|
2024-12-10 19:26:33 +00:00
|
|
|
popd
|
|
|
|
|
2021-10-14 17:34:36 +00:00
|
|
|
pushd libconfig/libconfig
|
|
|
|
autoreconf
|
|
|
|
popd
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-01-10 15:44:34 +00:00
|
|
|
pushd libdaemon/libdaemon
|
|
|
|
autoreconf
|
|
|
|
popd
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2023-03-14 20:38:41 +00:00
|
|
|
pushd pcre/pcre
|
|
|
|
autoreconf
|
2024-12-10 19:26:33 +00:00
|
|
|
popd
|
|
|
|
|
2023-03-14 20:38:41 +00:00
|
|
|
popd
|
2021-10-14 17:34:36 +00:00
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/{etc,bin,lib/systemd/system}
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
sed -i s_/usr/bin/proxysql_$out/bin/proxysql_ $out/lib/systemd/system/*.service
|
|
|
|
'';
|
|
|
|
|
2023-11-17 12:35:31 +00:00
|
|
|
meta = with lib; {
|
2021-10-14 17:34:36 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
|
|
description = "High-performance MySQL proxy";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "proxysql";
|
2023-07-31 08:25:54 +00:00
|
|
|
homepage = "https://proxysql.com/";
|
2023-11-17 12:35:31 +00:00
|
|
|
license = with licenses; [ gpl3Only ];
|
|
|
|
maintainers = teams.helsinki-systems.members;
|
|
|
|
platforms = platforms.unix;
|
2021-10-14 17:34:36 +00:00
|
|
|
};
|
2023-07-31 08:25:54 +00:00
|
|
|
})
|