at 24.05-pre 174 lines 3.4 kB view raw
1{ stdenv 2, lib 3, applyPatches 4, fetchFromGitHub 5, autoconf 6, automake 7, bison 8, cmake 9, libtool 10, civetweb 11, coreutils 12, curl 13, flex 14, gnutls 15, libconfig 16, libdaemon 17, libev 18, libgcrypt 19, libinjection 20, libmicrohttpd_0_9_69 21, libuuid 22, lz4 23, nlohmann_json 24, openssl 25, pcre 26, perl 27, python3 28, prometheus-cpp 29, zlib 30, texinfo 31}: 32 33stdenv.mkDerivation (finalAttrs: { 34 pname = "proxysql"; 35 version = "2.5.5"; 36 37 src = fetchFromGitHub { 38 owner = "sysown"; 39 repo = "proxysql"; 40 rev = finalAttrs.version; 41 hash = "sha256-+3cOEM5b5HBQhuI+92meupvQnrUj8jgbedzPJqMoXc8="; 42 }; 43 44 patches = [ 45 ./makefiles.patch 46 ./dont-phone-home.patch 47 ]; 48 49 nativeBuildInputs = [ 50 autoconf 51 automake 52 cmake 53 libtool 54 perl 55 python3 56 texinfo # for makeinfo 57 ]; 58 59 buildInputs = [ 60 bison 61 curl 62 flex 63 gnutls 64 libgcrypt 65 libuuid 66 zlib 67 ]; 68 69 enableParallelBuilding = true; 70 71 GIT_VERSION = finalAttrs.version; 72 73 dontConfigure = true; 74 75 # replace and fix some vendored dependencies 76 preBuild = /* sh */ '' 77 pushd deps 78 79 function replace_dep() { 80 local folder="$1" 81 local src="$2" 82 local symlink="$3" 83 local name="$4" 84 85 pushd "$folder" 86 87 rm -rf "$symlink" 88 if [ -d "$src" ]; then 89 cp -R "$src"/. "$symlink" 90 chmod -R u+w "$symlink" 91 else 92 tar xf "$src" 93 ln -s "$name" "$symlink" 94 fi 95 96 popd 97 } 98 99 ${lib.concatMapStringsSep "\n" 100 (x: ''replace_dep "${x.f}" "${x.p.src}" "${x.p.pname or (builtins.parseDrvName x.p.name).name}" "${x.p.name}"'') ( 101 map (x: { 102 inherit (x) f; 103 p = x.p // { 104 src = applyPatches { 105 inherit (x.p) src patches; 106 }; 107 }; 108 }) [ 109 { f = "curl"; p = curl; } 110 { f = "libconfig"; p = libconfig; } 111 { f = "libdaemon"; p = libdaemon; } 112 { f = "libev"; p = libev; } 113 { f = "libinjection"; p = libinjection; } 114 { f = "libmicrohttpd"; p = libmicrohttpd_0_9_69; } 115 { f = "libssl"; p = openssl; } 116 { f = "lz4"; p = lz4; } 117 { f = "pcre"; p = pcre; } 118 { f = "prometheus-cpp"; p = prometheus-cpp; } 119 ] 120 )} 121 122 pushd libhttpserver 123 tar xf libhttpserver-*.tar.gz 124 sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac 125 popd 126 127 pushd json 128 rm json.hpp 129 ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp . 130 popd 131 132 pushd prometheus-cpp/prometheus-cpp/3rdparty 133 replace_dep . "${civetweb.src}" civetweb 134 popd 135 136 sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config 137 138 pushd libmicrohttpd/libmicrohttpd 139 autoreconf 140 popd 141 142 pushd libconfig/libconfig 143 autoreconf 144 popd 145 146 pushd libdaemon/libdaemon 147 autoreconf 148 popd 149 150 pushd pcre/pcre 151 autoreconf 152 popd 153 154 popd 155 patchShebangs . 156 ''; 157 158 preInstall = '' 159 mkdir -p $out/{etc,bin,lib/systemd/system} 160 ''; 161 162 postInstall = '' 163 sed -i s_/usr/bin/proxysql_$out/bin/proxysql_ $out/lib/systemd/system/*.service 164 ''; 165 166 meta = { 167 broken = stdenv.isDarwin; 168 description = "High-performance MySQL proxy"; 169 homepage = "https://proxysql.com/"; 170 license = with lib.licenses; [ gpl3Only ]; 171 maintainers = with lib.maintainers; [ ajs124 ]; 172 platforms = lib.platforms.unix; 173 }; 174})