tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
proxysql: init at 2.3.2
ajs124
4 years ago
028d78ea
4f292fe2
+337
4 changed files
expand all
collapse all
unified
split
pkgs
servers
sql
proxysql
default.nix
dont-phone-home.patch
makefiles.patch
top-level
all-packages.nix
+151
pkgs/servers/sql/proxysql/default.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ stdenv
2
+
, lib
3
+
, fetchFromGitHub
4
+
, fetchpatch
5
+
, autoconf
6
+
, automake
7
+
, bison
8
+
, cmake
9
+
, libtool
10
+
, civetweb
11
+
, coreutils
12
+
, curl
13
+
, flex
14
+
, gnutls
15
+
, jemalloc
16
+
, libconfig
17
+
, libdaemon
18
+
, libev
19
+
, libgcrypt
20
+
, libinjection
21
+
, libmicrohttpd_0_9_70
22
+
, lz4
23
+
, nlohmann_json
24
+
, openssl
25
+
, pcre
26
+
, perl
27
+
, prometheus-cpp
28
+
, python
29
+
, re2
30
+
, zlib
31
+
}:
32
+
33
+
stdenv.mkDerivation rec {
34
+
pname = "proxysql";
35
+
version = "2.3.2";
36
+
37
+
src = fetchFromGitHub {
38
+
owner = "sysown";
39
+
repo = pname;
40
+
rev = version;
41
+
sha256 = "13l4bf7zhfjy701qx9hfr40vlsm4d0pbfmwr5d6lf514xznvsnzl";
42
+
};
43
+
44
+
patches = [
45
+
./makefiles.patch
46
+
./dont-phone-home.patch
47
+
(fetchpatch {
48
+
url = "https://github.com/sysown/proxysql/pull/3402.patch";
49
+
sha256 = "079jjhvx32qxjczmsplkhzjn9gl7c2a3famssczmjv2ffs65vibi";
50
+
})
51
+
];
52
+
53
+
nativeBuildInputs = [
54
+
autoconf
55
+
automake
56
+
cmake
57
+
libtool
58
+
perl
59
+
python
60
+
];
61
+
62
+
buildInputs = [
63
+
bison
64
+
curl
65
+
flex
66
+
gnutls
67
+
libgcrypt
68
+
openssl
69
+
zlib
70
+
];
71
+
72
+
GIT_VERSION = version;
73
+
74
+
dontConfigure = true;
75
+
76
+
# replace and fix some vendored dependencies
77
+
preBuild = /* sh */ ''
78
+
pushd deps
79
+
80
+
function replace_dep() {
81
+
local folder="$1"
82
+
local src="$2"
83
+
local symlink="$3"
84
+
local name="$4"
85
+
86
+
pushd "$folder"
87
+
88
+
rm -rf "$symlink"
89
+
if [ -d "$src" ]; then
90
+
cp -R "$src"/. "$symlink"
91
+
chmod -R u+w "$symlink"
92
+
else
93
+
tar xf "$src"
94
+
ln -s "$name" "$symlink"
95
+
fi
96
+
97
+
popd
98
+
}
99
+
100
+
${lib.concatMapStringsSep "\n"
101
+
(x: ''replace_dep "${x.f}" "${x.p.src}" "${x.p.pname or (builtins.parseDrvName x.p.name).name}" "${x.p.name}"'') [
102
+
{ f = "curl"; p = curl; }
103
+
{ f = "jemalloc"; p = jemalloc; }
104
+
{ f = "libconfig"; p = libconfig; }
105
+
{ f = "libdaemon"; p = libdaemon; }
106
+
{ f = "libev"; p = libev; }
107
+
{ f = "libinjection"; p = libinjection; }
108
+
{ f = "libmicrohttpd"; p = libmicrohttpd_0_9_70; }
109
+
{ f = "libssl"; p = openssl; }
110
+
{ f = "lz4"; p = lz4; }
111
+
{ f = "pcre"; p = pcre; }
112
+
{ f = "prometheus-cpp"; p = prometheus-cpp; }
113
+
{ f = "re2"; p = re2; }
114
+
]}
115
+
116
+
pushd libhttpserver
117
+
tar xf libhttpserver-0.18.1.tar.gz
118
+
sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac
119
+
popd
120
+
121
+
pushd json
122
+
rm json.hpp
123
+
ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp .
124
+
popd
125
+
126
+
pushd prometheus-cpp/prometheus-cpp/3rdparty
127
+
replace_dep . "${civetweb.src}" civetweb
128
+
popd
129
+
130
+
sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config
131
+
132
+
popd
133
+
patchShebangs .
134
+
'';
135
+
136
+
preInstall = ''
137
+
mkdir -p $out/{etc,bin,lib/systemd/system}
138
+
'';
139
+
140
+
postInstall = ''
141
+
sed -i s_/usr/bin/proxysql_$out/bin/proxysql_ $out/lib/systemd/system/*.service
142
+
'';
143
+
144
+
meta = with lib; {
145
+
homepage = "https://proxysql.com/";
146
+
broken = stdenv.isDarwin;
147
+
description = "High-performance MySQL proxy";
148
+
license = with licenses; [ gpl3Only ];
149
+
maintainers = with maintainers; [ ajs124 ];
150
+
};
151
+
}
+12
pkgs/servers/sql/proxysql/dont-phone-home.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/src/main.cpp b/src/main.cpp
2
+
index 39dfaa24..634b004b 100644
3
+
--- a/src/main.cpp
4
+
+++ b/src/main.cpp
5
+
@@ -237,6 +237,7 @@ static char * main_check_latest_version() {
6
+
7
+
8
+
void * main_check_latest_version_thread(void *arg) {
9
+
+ return NULL;
10
+
char * latest_version = main_check_latest_version();
11
+
if (latest_version) {
12
+
if (
+172
pkgs/servers/sql/proxysql/makefiles.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
--- a/Makefile
2
+
+++ b/Makefile
3
+
@@ -46,11 +46,7 @@ endif
4
+
5
+
export MAKEOPT=-j ${NPROCS}
6
+
7
+
-ifeq ($(wildcard /usr/lib/systemd/system), /usr/lib/systemd/system)
8
+
- SYSTEMD=1
9
+
-else
10
+
- SYSTEMD=0
11
+
-endif
12
+
+SYSTEMD=1
13
+
USERCHECK := $(shell getent passwd proxysql)
14
+
GROUPCHECK := $(shell getent group proxysql)
15
+
16
+
@@ -523,16 +519,10 @@ cleanbuild:
17
+
18
+
.PHONY: install
19
+
install: src/proxysql
20
+
- install -m 0755 src/proxysql /usr/bin
21
+
- install -m 0600 etc/proxysql.cnf /etc
22
+
- if [ ! -d /var/lib/proxysql ]; then mkdir /var/lib/proxysql ; fi
23
+
-ifeq ($(findstring proxysql,$(USERCHECK)),)
24
+
- @echo "Creating proxysql user and group"
25
+
- useradd -r -U -s /bin/false proxysql
26
+
-endif
27
+
+ install -m 0755 src/proxysql $(out)/bin
28
+
+ install -m 0600 etc/proxysql.cnf $(out)/etc
29
+
ifeq ($(SYSTEMD), 1)
30
+
- install -m 0644 systemd/system/proxysql.service /usr/lib/systemd/system/
31
+
- systemctl enable proxysql.service
32
+
+ install -m 0644 systemd/system/proxysql.service $(out)/lib/systemd/system/
33
+
else
34
+
install -m 0755 etc/init.d/proxysql /etc/init.d
35
+
ifeq ($(DISTRO),"CentOS Linux")
36
+
--- a/deps/Makefile
37
+
+++ b/deps/Makefile
38
+
@@ -40,22 +40,10 @@ endif
39
+
40
+
41
+
libinjection/libinjection/src/libinjection.a:
42
+
- cd libinjection && rm -rf libinjection-3.10.0 || true
43
+
- cd libinjection && tar -zxf libinjection-3.10.0.tar.gz
44
+
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/make_parens.py
45
+
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/sqlparse_map.py
46
+
- sed -i -e 's/python/python2/' libinjection/libinjection-3.10.0/src/sqlparse2c.py
47
+
cd libinjection/libinjection && CC=${CC} CXX=${CXX} ${MAKE}
48
+
libinjection: libinjection/libinjection/src/libinjection.a
49
+
50
+
libssl/openssl/libssl.a:
51
+
-# cd libssl && rm -rf openssl-1.1.0h || true
52
+
-# cd libssl && tar -zxf openssl-1.1.0h.tar.gz
53
+
- cd libssl && rm -rf openssl-1.1.1d || true
54
+
- cd libssl && rm -rf openssl-1.1.0h || true
55
+
- cd libssl && rm -rf openssl-1.1.1g || true
56
+
- cd libssl && rm -rf openssl-1.1.1j || true
57
+
- cd libssl && tar -zxf openssl-1.1.1j.tar.gz
58
+
cd libssl/openssl && ./config no-ssl3
59
+
cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE}
60
+
cd libssl/openssl && ln -s . lib # curl wants this path
61
+
@@ -70,9 +58,6 @@ ifeq ($(MIN_VERSION),$(lastword $(sort $(GCC_VERSION) $(MIN_VERSION))))
62
+
endif
63
+
64
+
libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
65
+
- cd libhttpserver && rm -rf libhttpserver-master_20191121 || true
66
+
- cd libhttpserver && rm -rf libhttpserver-0.18.1 || true
67
+
- cd libhttpserver && tar -zxf libhttpserver-0.18.1.tar.gz
68
+
ifeq ($(REQUIRE_PATCH), true)
69
+
cd libhttpserver/libhttpserver && patch src/httpserver/basic_auth_fail_response.hpp < ../basic_auth_fail_response.hpp.patch
70
+
cd libhttpserver/libhttpserver && patch src/httpserver/create_webserver.hpp < ../create_webserver.hpp.patch
71
+
@@ -94,34 +79,15 @@ endif
72
+
libhttpserver: libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a
73
+
74
+
libev/libev/.libs/libev.a:
75
+
- cd libev && rm -rf libev-4.24 || true
76
+
- cd libev && tar -zxf libev-4.24.tar.gz
77
+
cd libev/libev && ./configure
78
+
cd libev/libev && CC=${CC} CXX=${CXX} ${MAKE}
79
+
ev: libev/libev/.libs/libev.a
80
+
81
+
curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
82
+
- cd curl && rm -rf curl-7.57.0 || true
83
+
- cd curl && rm -rf curl-7.77.0 || true
84
+
- cd curl && tar -zxf curl-7.77.0.tar.gz
85
+
- #cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
86
+
cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE}
87
+
curl: curl/curl/lib/.libs/libcurl.a
88
+
89
+
libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a:
90
+
- cd libmicrohttpd && rm -rf libmicrohttpd-0.9.55 || true
91
+
- cd libmicrohttpd && rm -rf libmicrohttpd-0.9.68 || true
92
+
- cd libmicrohttpd && rm -f libmicrohttpd || true
93
+
-ifeq ($(CENTOSVER),6)
94
+
- cd libmicrohttpd && ln -s libmicrohttpd-0.9.55 libmicrohttpd
95
+
- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.55.tar.gz
96
+
-else
97
+
- cd libmicrohttpd && ln -s libmicrohttpd-0.9.68 libmicrohttpd
98
+
- cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.68.tar.gz
99
+
-endif
100
+
-ifeq ($(OS),Darwin)
101
+
- cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/mhd_sockets.c < ../mhd_sockets.c-issue-5977.patch
102
+
-endif
103
+
cd libmicrohttpd/libmicrohttpd && ./configure --enable-https && CC=${CC} CXX=${CXX} ${MAKE}
104
+
microhttpd: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
105
+
106
+
@@ -132,8 +98,6 @@ cityhash/cityhash/src/.libs/libcityhash.a:
107
+
cityhash: cityhash/cityhash/src/.libs/libcityhash.a
108
+
109
+
lz4/lz4/liblz4.a:
110
+
- cd lz4 && rm -rf lz4-1.7.5 || true
111
+
- cd lz4 && tar -zxf lz4-1.7.5.tar.gz
112
+
cd lz4/lz4 && CC=${CC} CXX=${CXX} ${MAKE}
113
+
lz4: lz4/lz4/liblz4.a
114
+
115
+
@@ -148,16 +112,12 @@ clickhouse-cpp: clickhouse-cpp/clickhouse-cpp/clickhouse/libclickhouse-cpp-lib.a
116
+
117
+
118
+
libdaemon/libdaemon/libdaemon/.libs/libdaemon.a:
119
+
- cd libdaemon && rm -rf libdaemon-0.14
120
+
- cd libdaemon && tar -zxf libdaemon-0.14.tar.gz
121
+
cd libdaemon/libdaemon && cp ../config.guess . && chmod +x config.guess && ./configure --disable-examples
122
+
cd libdaemon/libdaemon && CC=${CC} CXX=${CXX} ${MAKE}
123
+
124
+
libdaemon: libdaemon/libdaemon/libdaemon/.libs/libdaemon.a
125
+
126
+
jemalloc/jemalloc/lib/libjemalloc.a:
127
+
- cd jemalloc && rm -rf jemalloc-5.2.0
128
+
- cd jemalloc && tar -jxf jemalloc-5.2.0.tar.bz2
129
+
cd jemalloc/jemalloc && patch src/jemalloc.c < ../issue823.520.patch
130
+
cd jemalloc/jemalloc && patch src/jemalloc.c < ../issue2358.patch
131
+
cd jemalloc/jemalloc && ./configure ${MYJEOPT}
132
+
@@ -210,17 +170,12 @@ sqlite3/sqlite3/sqlite3.o:
133
+
sqlite3: sqlite3/sqlite3/sqlite3.o
134
+
135
+
libconfig/libconfig/lib/.libs/libconfig++.a:
136
+
- cd libconfig && rm -rf libconfig-1.7.2
137
+
- cd libconfig && tar -zxf libconfig-1.7.2.tar.gz
138
+
cd libconfig/libconfig && ./configure --disable-examples
139
+
cd libconfig/libconfig && CC=${CC} CXX=${CXX} ${MAKE}
140
+
141
+
libconfig: libconfig/libconfig/lib/.libs/libconfig++.a
142
+
143
+
prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
144
+
- cd prometheus-cpp && rm -rf prometheus-cpp-0.9.0
145
+
- cd prometheus-cpp && tar -zxf v0.9.0.tar.gz
146
+
- cd prometheus-cpp && tar --strip-components=1 -zxf civetweb-v1.11.tar.gz -C prometheus-cpp/3rdparty/civetweb
147
+
cd prometheus-cpp/prometheus-cpp && patch -p1 < ../serial_exposer.patch
148
+
cd prometheus-cpp/prometheus-cpp && patch -p0 < ../registry_counters_reset.patch
149
+
cd prometheus-cpp/prometheus-cpp && cmake . -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DENABLE_PUSH=OFF
150
+
@@ -229,12 +184,6 @@ prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
151
+
prometheus-cpp: prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a
152
+
153
+
re2/re2/obj/libre2.a:
154
+
- cd re2 && rm -rf re2-2018-07-01 || true
155
+
- cd re2 && rm -rf re2-2020-07-06 || true
156
+
-# cd re2 && tar -zxf re2-20140304.tgz
157
+
- cd re2 && tar -zxf re2.tar.gz
158
+
-# cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
159
+
-# cd re2 && patch re2/util/mutex.h < mutex.h.patch
160
+
cd re2/re2 && sed -i -e 's/-O3 /-O3 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
161
+
cd re2/re2 && sed -i -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
162
+
cd re2/re2 && CC=${CC} CXX=${CXX} ${MAKE}
163
+
@@ -242,9 +191,6 @@ re2/re2/obj/libre2.a:
164
+
re2: re2/re2/obj/libre2.a
165
+
166
+
pcre/pcre/.libs/libpcre.a:
167
+
- cd pcre && rm -rf pcre-8.39
168
+
- cd pcre && rm -rf pcre-8.44
169
+
- cd pcre && tar -zxf pcre-8.44.tar.gz
170
+
cd pcre/pcre && ./configure
171
+
cd pcre/pcre && CC=${CC} CXX=${CXX} ${MAKE}
172
+
pcre: pcre/pcre/.libs/libpcre.a
+2
pkgs/top-level/all-packages.nix
···
8544
8545
proxify = callPackage ../tools/networking/proxify { };
8546
0
0
8547
proxytunnel = callPackage ../tools/misc/proxytunnel {
8548
openssl = openssl_1_0_2;
8549
};
···
8544
8545
proxify = callPackage ../tools/networking/proxify { };
8546
8547
+
proxysql = callPackage ../servers/sql/proxysql { };
8548
+
8549
proxytunnel = callPackage ../tools/misc/proxytunnel {
8550
openssl = openssl_1_0_2;
8551
};