Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 175 lines 3.3 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, re2 30, zlib 31, texinfo 32}: 33 34stdenv.mkDerivation rec { 35 pname = "proxysql"; 36 version = "2.5.2"; 37 38 src = fetchFromGitHub { 39 owner = "sysown"; 40 repo = pname; 41 rev = version; 42 hash = "sha256-KPTvFbEreWQBAs5ofcdVzlVqL0t5pM/mMLv4+E4lJ5M="; 43 }; 44 45 patches = [ 46 ./makefiles.patch 47 ./dont-phone-home.patch 48 ]; 49 50 nativeBuildInputs = [ 51 autoconf 52 automake 53 cmake 54 libtool 55 perl 56 python3 57 texinfo # for makeinfo 58 ]; 59 60 buildInputs = [ 61 bison 62 curl 63 flex 64 gnutls 65 libgcrypt 66 libuuid 67 zlib 68 ]; 69 70 enableParallelBuilding = true; 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 map (x: { 103 inherit (x) f; 104 p = x.p // { 105 src = applyPatches { 106 inherit (x.p) src patches; 107 }; 108 }; 109 }) [ 110 { f = "curl"; p = curl; } 111 { f = "libconfig"; p = libconfig; } 112 { f = "libdaemon"; p = libdaemon; } 113 { f = "libev"; p = libev; } 114 { f = "libinjection"; p = libinjection; } 115 { f = "libmicrohttpd"; p = libmicrohttpd_0_9_69; } 116 { f = "libssl"; p = openssl; } 117 { f = "lz4"; p = lz4; } 118 { f = "pcre"; p = pcre; } 119 { f = "prometheus-cpp"; p = prometheus-cpp; } 120 { f = "re2"; p = re2; } 121 ] 122 )} 123 124 pushd libhttpserver 125 tar xf libhttpserver-*.tar.gz 126 sed -i s_/bin/pwd_${coreutils}/bin/pwd_g libhttpserver/configure.ac 127 popd 128 129 pushd json 130 rm json.hpp 131 ln -s ${nlohmann_json.src}/single_include/nlohmann/json.hpp . 132 popd 133 134 pushd prometheus-cpp/prometheus-cpp/3rdparty 135 replace_dep . "${civetweb.src}" civetweb 136 popd 137 138 sed -i s_/usr/bin/env_${coreutils}/bin/env_g libssl/openssl/config 139 140 pushd libmicrohttpd/libmicrohttpd 141 autoreconf 142 popd 143 144 pushd libconfig/libconfig 145 autoreconf 146 popd 147 148 pushd libdaemon/libdaemon 149 autoreconf 150 popd 151 152 pushd pcre/pcre 153 autoreconf 154 popd 155 156 popd 157 patchShebangs . 158 ''; 159 160 preInstall = '' 161 mkdir -p $out/{etc,bin,lib/systemd/system} 162 ''; 163 164 postInstall = '' 165 sed -i s_/usr/bin/proxysql_$out/bin/proxysql_ $out/lib/systemd/system/*.service 166 ''; 167 168 meta = with lib; { 169 homepage = "https://proxysql.com/"; 170 broken = stdenv.isDarwin; 171 description = "High-performance MySQL proxy"; 172 license = with licenses; [ gpl3Only ]; 173 maintainers = with maintainers; [ ajs124 ]; 174 }; 175}