1{ useLua ? !stdenv.isDarwin
2, usePcre ? true
3, stdenv, fetchurl
4, openssl, zlib, lua5_3 ? null, pcre ? null
5}:
6
7assert useLua -> lua5_3 != null;
8assert usePcre -> pcre != null;
9
10stdenv.mkDerivation rec {
11 pname = "haproxy";
12 majorVersion = "1.7";
13 minorVersion = "8";
14 version = "${majorVersion}.${minorVersion}";
15 name = "${pname}-${version}";
16
17 src = fetchurl {
18 url = "http://www.haproxy.org/download/${majorVersion}/src/${name}.tar.gz";
19 sha256 = "0hp1k957idaphhmw4m0x8cdzdw9ga1mzgsnk2m0as86xrqy1b47c";
20 };
21
22 buildInputs = [ openssl zlib ]
23 ++ stdenv.lib.optional useLua lua5_3
24 ++ stdenv.lib.optional usePcre pcre;
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 "linux2628"
31 else if stdenv.isDarwin then "osx"
32 else "generic"))
33 ];
34 buildFlags = [
35 "USE_OPENSSL=yes"
36 "USE_ZLIB=yes"
37 ] ++ stdenv.lib.optionals usePcre [
38 "USE_PCRE=yes"
39 "USE_PCRE_JIT=yes"
40 ] ++ stdenv.lib.optionals useLua [
41 "USE_LUA=yes"
42 "LUA_LIB=${lua5_3}/lib"
43 "LUA_INC=${lua5_3}/include"
44 ] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc";
45
46 meta = {
47 description = "Reliable, high performance TCP/HTTP load balancer";
48 longDescription = ''
49 HAProxy is a free, very fast and reliable solution offering high
50 availability, load balancing, and proxying for TCP and HTTP-based
51 applications. It is particularly suited for web sites crawling under very
52 high loads while needing persistence or Layer7 processing. Supporting
53 tens of thousands of connections is clearly realistic with todays
54 hardware.
55 '';
56 homepage = http://haproxy.1wt.eu;
57 maintainers = with stdenv.lib.maintainers; [ fuzzy-id garbas ];
58 platforms = with stdenv.lib.platforms; linux ++ darwin;
59 license = stdenv.lib.licenses.gpl2;
60 };
61}