Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 136 lines 3.2 kB view raw
1{ 2 useLua ? true, 3 usePcre ? true, 4 withPrometheusExporter ? true, 5 sslLibrary ? "quictls", 6 stdenv, 7 lib, 8 fetchurl, 9 nixosTests, 10 zlib, 11 libxcrypt, 12 aws-lc, 13 libressl, 14 openssl, 15 quictls, 16 wolfssl, 17 lua5_4, 18 pcre2, 19}: 20 21assert lib.assertOneOf "sslLibrary" sslLibrary [ 22 "aws-lc" 23 "libressl" 24 "openssl" 25 "quictls" 26 "wolfssl" 27]; 28let 29 sslPkgs = { 30 inherit 31 aws-lc 32 libressl 33 openssl 34 quictls 35 ; 36 wolfssl = wolfssl.override { 37 variant = "haproxy"; 38 extraConfigureFlags = [ "--enable-quic" ]; 39 }; 40 }; 41 sslPkg = sslPkgs.${sslLibrary}; 42in 43stdenv.mkDerivation (finalAttrs: { 44 pname = "haproxy"; 45 version = "3.2.3"; 46 47 src = fetchurl { 48 url = "https://www.haproxy.org/download/${lib.versions.majorMinor finalAttrs.version}/src/haproxy-${finalAttrs.version}.tar.gz"; 49 hash = "sha256-r472Qoa93ckyMsXb5OpDaozLXchBfPoeiFvsUohPk0c="; 50 }; 51 52 buildInputs = [ 53 sslPkg 54 zlib 55 libxcrypt 56 ] 57 ++ lib.optional useLua lua5_4 58 ++ lib.optional usePcre pcre2; 59 60 # TODO: make it work on bsd as well 61 makeFlags = [ 62 "PREFIX=${placeholder "out"}" 63 ( 64 "TARGET=" 65 + ( 66 if stdenv.hostPlatform.isSunOS then 67 "solaris" 68 else if stdenv.hostPlatform.isLinux then 69 "linux-glibc" 70 else if stdenv.hostPlatform.isDarwin then 71 "osx" 72 else 73 "generic" 74 ) 75 ) 76 ]; 77 78 buildFlags = [ 79 "USE_ZLIB=yes" 80 "USE_OPENSSL=yes" 81 "SSL_INC=${lib.getDev sslPkg}/include" 82 "SSL_LIB=${lib.getDev sslPkg}/lib" 83 "USE_QUIC=yes" 84 ] 85 ++ lib.optionals (sslLibrary == "aws-lc") [ 86 "USE_OPENSSL_AWSLC=true" 87 ] 88 ++ lib.optionals (sslLibrary == "openssl") [ 89 "USE_QUIC_OPENSSL_COMPAT=yes" 90 ] 91 ++ lib.optionals (sslLibrary == "wolfssl") [ 92 "USE_OPENSSL_WOLFSSL=yes" 93 ] 94 ++ lib.optionals usePcre [ 95 "USE_PCRE2=yes" 96 "USE_PCRE2_JIT=yes" 97 ] 98 ++ lib.optionals useLua [ 99 "USE_LUA=yes" 100 "LUA_LIB_NAME=lua" 101 "LUA_LIB=${lua5_4}/lib" 102 "LUA_INC=${lua5_4}/include" 103 ] 104 ++ lib.optionals stdenv.hostPlatform.isLinux [ 105 "USE_GETADDRINFO=1" 106 ] 107 ++ lib.optionals withPrometheusExporter [ 108 "USE_PROMEX=yes" 109 ] 110 ++ [ "CC=${stdenv.cc.targetPrefix}cc" ]; 111 112 enableParallelBuilding = true; 113 114 passthru.tests.haproxy = nixosTests.haproxy; 115 116 meta = { 117 changelog = "https://www.haproxy.org/download/${lib.versions.majorMinor finalAttrs.version}/src/CHANGELOG"; 118 description = "Reliable, high performance TCP/HTTP load balancer"; 119 homepage = "https://haproxy.org"; 120 license = with lib.licenses; [ 121 gpl2Plus 122 lgpl21Only 123 ]; 124 longDescription = '' 125 HAProxy is a free, very fast and reliable solution offering high 126 availability, load balancing, and proxying for TCP and HTTP-based 127 applications. It is particularly suited for web sites crawling under very 128 high loads while needing persistence or Layer7 processing. Supporting 129 tens of thousands of connections is clearly realistic with todays 130 hardware. 131 ''; 132 maintainers = with lib.maintainers; [ vifino ]; 133 platforms = with lib.platforms; linux ++ darwin; 134 mainProgram = "haproxy"; 135 }; 136})