2021-12-06 16:07:01 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoconf
|
|
|
|
, automake
|
|
|
|
, bison
|
|
|
|
, cmake
|
|
|
|
, libtool
|
|
|
|
, civetweb
|
|
|
|
, coreutils
|
|
|
|
, curl
|
|
|
|
, flex
|
|
|
|
, gnutls
|
|
|
|
, libconfig
|
|
|
|
, libdaemon
|
|
|
|
, libev
|
|
|
|
, libgcrypt
|
|
|
|
, libinjection
|
|
|
|
, libmicrohttpd_0_9_70
|
2022-08-21 13:32:41 +00:00
|
|
|
, libuuid
|
2021-12-06 16:07:01 +00:00
|
|
|
, lz4
|
|
|
|
, nlohmann_json
|
2022-09-14 18:05:37 +00:00
|
|
|
, openssl
|
2021-12-06 16:07:01 +00:00
|
|
|
, pcre
|
|
|
|
, perl
|
2022-01-19 23:45:15 +00:00
|
|
|
, python2
|
2021-12-06 16:07:01 +00:00
|
|
|
, re2
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "proxysql";
|
2022-09-22 12:36:57 +00:00
|
|
|
version = "2.4.4";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sysown";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-09-22 12:36:57 +00:00
|
|
|
hash = "sha256-S0Oy0uQPbAn52KM0r7yxLvVl1DKQwRW3QYVHtJ20CnM=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./makefiles.patch
|
|
|
|
./dont-phone-home.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
cmake
|
|
|
|
libtool
|
|
|
|
perl
|
2022-01-19 23:45:15 +00:00
|
|
|
python2
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
bison
|
2022-09-14 18:05:37 +00:00
|
|
|
curl
|
2021-12-06 16:07:01 +00:00
|
|
|
flex
|
|
|
|
gnutls
|
|
|
|
libgcrypt
|
2022-08-21 13:32:41 +00:00
|
|
|
libuuid
|
2021-12-06 16:07:01 +00:00
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
GIT_VERSION = version;
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
# replace and fix some vendored dependencies
|
|
|
|
preBuild = /* sh */ ''
|
|
|
|
pushd deps
|
|
|
|
|
|
|
|
function replace_dep() {
|
|
|
|
local folder="$1"
|
|
|
|
local src="$2"
|
|
|
|
local symlink="$3"
|
|
|
|
local name="$4"
|
|
|
|
|
|
|
|
pushd "$folder"
|
|
|
|
|
|
|
|
rm -rf "$symlink"
|
|
|
|
if [ -d "$src" ]; then
|
|
|
|
cp -R "$src"/. "$symlink"
|
|
|
|
chmod -R u+w "$symlink"
|
|
|
|
else
|
|
|
|
tar xf "$src"
|
|
|
|
ln -s "$name" "$symlink"
|
|
|
|
fi
|
|
|
|
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
${lib.concatMapStringsSep "\n"
|
|
|
|
(x: ''replace_dep "${x.f}" "${x.p.src}" "${x.p.pname or (builtins.parseDrvName x.p.name).name}" "${x.p.name}"'') [
|
|
|
|
{ f = "curl"; p = curl; }
|
|
|
|
{ f = "libconfig"; p = libconfig; }
|
|
|
|
{ f = "libdaemon"; p = libdaemon; }
|
|
|
|
{ f = "libev"; p = libev; }
|
|
|
|
{ f = "libinjection"; p = libinjection; }
|
|
|
|
{ f = "libmicrohttpd"; p = libmicrohttpd_0_9_70; }
|
2022-09-14 18:05:37 +00:00
|
|
|
{ f = "libssl"; p = openssl; }
|
2021-12-06 16:07:01 +00:00
|
|
|
{ f = "lz4"; p = lz4; }
|
|
|
|
{ f = "pcre"; p = pcre; }
|
|
|
|
{ f = "re2"; p = re2; }
|
|
|
|
]}
|
|
|
|
|
|
|
|
pushd libhttpserver
|
|
|
|
tar xf libhttpserver-0.18.1.tar.gz
|
|
|
|
sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac
|
|
|
|
popd
|
|
|
|
|
|
|
|
pushd json
|
|
|
|
rm json.hpp
|
|
|
|
ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp .
|
|
|
|
popd
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
pushd prometheus-cpp
|
|
|
|
tar xf v0.9.0.tar.gz
|
|
|
|
replace_dep prometheus-cpp/3rdparty "${civetweb.src}" civetweb
|
2021-12-06 16:07:01 +00:00
|
|
|
popd
|
|
|
|
|
|
|
|
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config
|
|
|
|
|
|
|
|
popd
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://proxysql.com/";
|
|
|
|
broken = stdenv.isDarwin;
|
|
|
|
description = "High-performance MySQL proxy";
|
|
|
|
license = with licenses; [ gpl3Only ];
|
|
|
|
maintainers = with maintainers; [ ajs124 ];
|
|
|
|
};
|
|
|
|
}
|