nixpkgs/pkgs/by-name/pr/proxysql/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

217 lines
4.0 KiB
Nix
Raw Normal View History

2021-10-14 17:34:36 +00:00
{
stdenv,
lib,
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,
libuuid,
2021-10-14 17:34:36 +00:00
lz4,
nlohmann_json,
openssl,
2021-10-14 17:34:36 +00:00
pcre,
perl,
python3,
prometheus-cpp,
2021-10-14 17:34:36 +00:00
zlib,
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
python3
texinfo # for makeinfo
2021-10-14 17:34:36 +00:00
];
buildInputs = [
bison
curl
2021-10-14 17:34:36 +00:00
flex
gnutls
libgcrypt
libuuid
2021-10-14 17:34:36 +00:00
zlib
];
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
2021-10-14 17:34:36 +00:00
function replace_dep() {
local folder="$1"
local src="$2"
local symlink="$3"
local name="$4"
2021-10-14 17:34:36 +00:00
pushd "$folder"
2021-10-14 17:34:36 +00:00
rm -rf "$symlink"
if [ -d "$src" ]; then
cp -R "$src"/. "$symlink"
chmod -R u+w "$symlink"
else
tar xf "$src"
2021-10-14 17:34:36 +00:00
ln -s "$name" "$symlink"
fi
2021-10-14 17:34:36 +00:00
popd
}
2021-10-14 17:34:36 +00:00
${lib.concatMapStringsSep "\n"
(
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}"''
)
(
map
(x: {
inherit (x) f;
p = x.p // {
2021-10-14 17:34:36 +00:00
src = applyPatches {
inherit (x.p) src patches;
};
};
})
[
{
f = "curl";
p = curl;
}
{
f = "libconfig";
p = libconfig;
}
{
f = "libdaemon";
p = libdaemon;
}
{
f = "libev";
p = libev;
}
{
f = "libinjection";
p = libinjection;
}
{
2024-01-04 22:50:06 +00:00
f = "libmicrohttpd";
p = libmicrohttpd;
}
{
f = "libssl";
p = openssl;
}
{
f = "lz4";
p = lz4;
}
{
f = "pcre";
p = pcre;
}
{
f = "prometheus-cpp";
p = prometheus-cpp;
}
]
)
}
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
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
pushd prometheus-cpp/prometheus-cpp/3rdparty
replace_dep . "${civetweb.src}" civetweb
popd
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config
2024-01-04 22:50:06 +00:00
pushd libmicrohttpd/libmicrohttpd
2021-10-14 17:34:36 +00:00
autoreconf
popd
2021-10-14 17:34:36 +00:00
pushd libconfig/libconfig
autoreconf
popd
2023-01-10 15:44:34 +00:00
pushd libdaemon/libdaemon
autoreconf
popd
pushd pcre/pcre
autoreconf
popd
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
'';
meta = with lib; {
2021-10-14 17:34:36 +00:00
broken = stdenv.hostPlatform.isDarwin;
description = "High-performance MySQL proxy";
mainProgram = "proxysql";
2023-07-31 08:25:54 +00:00
homepage = "https://proxysql.com/";
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
})