nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 69 lines 2.1 kB view raw
1{ useLua ? !stdenv.isDarwin 2, usePcre ? true 3, withPrometheusExporter ? true 4, stdenv, lib, fetchurl 5, openssl, zlib 6, lua5_3 ? null, pcre ? null, systemd ? null 7}: 8 9assert useLua -> lua5_3 != null; 10assert usePcre -> pcre != null; 11 12stdenv.mkDerivation rec { 13 pname = "haproxy"; 14 version = "2.1.2"; 15 16 src = fetchurl { 17 url = "https://www.haproxy.org/download/${stdenv.lib.versions.majorMinor version}/src/${pname}-${version}.tar.gz"; 18 sha256 = "0xqb64nyl7hqnzpqb2jhv1ash47fcf4sspl3lalybb85i65b0yb0"; 19 }; 20 21 buildInputs = [ openssl zlib ] 22 ++ lib.optional useLua lua5_3 23 ++ lib.optional usePcre pcre 24 ++ lib.optional stdenv.isLinux systemd; 25 26 # TODO: make it work on bsd as well 27 makeFlags = [ 28 "PREFIX=\${out}" 29 ("TARGET=" + (if stdenv.isSunOS then "solaris" 30 else if stdenv.isLinux then "linux-glibc" 31 else if stdenv.isDarwin then "osx" 32 else "generic")) 33 ]; 34 35 buildFlags = [ 36 "USE_OPENSSL=yes" 37 "USE_ZLIB=yes" 38 ] ++ lib.optionals usePcre [ 39 "USE_PCRE=yes" 40 "USE_PCRE_JIT=yes" 41 ] ++ lib.optionals useLua [ 42 "USE_LUA=yes" 43 "LUA_LIB=${lua5_3}/lib" 44 "LUA_INC=${lua5_3}/include" 45 ] ++ lib.optionals stdenv.isLinux [ 46 "USE_SYSTEMD=yes" 47 "USE_GETADDRINFO=1" 48 ] ++ lib.optionals withPrometheusExporter [ 49 "EXTRA_OBJS=contrib/prometheus-exporter/service-prometheus.o" 50 ] ++ lib.optional stdenv.isDarwin "CC=cc"; 51 52 enableParallelBuilding = true; 53 54 meta = with lib; { 55 description = "Reliable, high performance TCP/HTTP load balancer"; 56 longDescription = '' 57 HAProxy is a free, very fast and reliable solution offering high 58 availability, load balancing, and proxying for TCP and HTTP-based 59 applications. It is particularly suited for web sites crawling under very 60 high loads while needing persistence or Layer7 processing. Supporting 61 tens of thousands of connections is clearly realistic with todays 62 hardware. 63 ''; 64 homepage = "https://haproxy.org"; 65 license = licenses.gpl2; 66 maintainers = with maintainers; [ fuzzy-id ]; 67 platforms = with platforms; linux ++ darwin; 68 }; 69}