2017-03-29 11:27:50 +01:00
|
|
|
{ useLua ? !stdenv.isDarwin
|
|
|
|
, usePcre ? true
|
2019-11-08 04:25:03 +00:00
|
|
|
, withPrometheusExporter ? true
|
|
|
|
, stdenv, lib, fetchurl
|
|
|
|
, openssl, zlib
|
|
|
|
, lua5_3 ? null, pcre ? null, systemd ? null
|
2017-03-27 09:21:19 +01:00
|
|
|
}:
|
|
|
|
|
2017-03-29 11:27:50 +01:00
|
|
|
assert useLua -> lua5_3 != null;
|
2017-03-27 09:21:19 +01:00
|
|
|
assert usePcre -> pcre != null;
|
2012-05-18 08:50:10 +01:00
|
|
|
|
2013-07-03 02:36:15 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2017-01-26 08:37:51 +00:00
|
|
|
pname = "haproxy";
|
2020-03-05 04:38:58 +00:00
|
|
|
version = "2.1.3";
|
2013-10-29 14:55:25 +00:00
|
|
|
|
2012-05-18 08:50:10 +01:00
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "https://www.haproxy.org/download/${stdenv.lib.versions.majorMinor version}/src/${pname}-${version}.tar.gz";
|
2020-03-05 04:38:58 +00:00
|
|
|
sha256 = "0n8bw3d6gikr8c56ycrvksp1sl0b4yfzp19867cxkl3l0daqwrxv";
|
2012-05-18 08:50:10 +01:00
|
|
|
};
|
|
|
|
|
2017-03-27 09:21:19 +01:00
|
|
|
buildInputs = [ openssl zlib ]
|
2019-11-08 04:25:03 +00:00
|
|
|
++ lib.optional useLua lua5_3
|
|
|
|
++ lib.optional usePcre pcre
|
|
|
|
++ lib.optional stdenv.isLinux systemd;
|
2012-05-18 08:50:10 +01:00
|
|
|
|
2017-03-07 17:50:45 +00:00
|
|
|
# TODO: make it work on bsd as well
|
2017-03-14 20:39:40 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=\${out}"
|
|
|
|
("TARGET=" + (if stdenv.isSunOS then "solaris"
|
2019-11-08 04:25:03 +00:00
|
|
|
else if stdenv.isLinux then "linux-glibc"
|
2017-03-14 20:39:40 +00:00
|
|
|
else if stdenv.isDarwin then "osx"
|
|
|
|
else "generic"))
|
|
|
|
];
|
2019-11-08 04:25:03 +00:00
|
|
|
|
2017-03-14 20:39:40 +00:00
|
|
|
buildFlags = [
|
|
|
|
"USE_OPENSSL=yes"
|
|
|
|
"USE_ZLIB=yes"
|
2019-11-08 04:25:03 +00:00
|
|
|
] ++ lib.optionals usePcre [
|
2017-03-27 09:21:19 +01:00
|
|
|
"USE_PCRE=yes"
|
|
|
|
"USE_PCRE_JIT=yes"
|
2019-11-08 04:25:03 +00:00
|
|
|
] ++ lib.optionals useLua [
|
2017-03-27 09:21:19 +01:00
|
|
|
"USE_LUA=yes"
|
2017-03-29 11:27:50 +01:00
|
|
|
"LUA_LIB=${lua5_3}/lib"
|
|
|
|
"LUA_INC=${lua5_3}/include"
|
2019-11-08 04:25:03 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"USE_SYSTEMD=yes"
|
|
|
|
"USE_GETADDRINFO=1"
|
|
|
|
] ++ lib.optionals withPrometheusExporter [
|
|
|
|
"EXTRA_OBJS=contrib/prometheus-exporter/service-prometheus.o"
|
|
|
|
] ++ lib.optional stdenv.isDarwin "CC=cc";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2013-07-03 02:36:15 +01:00
|
|
|
|
2019-11-08 04:25:03 +00:00
|
|
|
meta = with lib; {
|
2013-10-06 10:49:53 +01:00
|
|
|
description = "Reliable, high performance TCP/HTTP load balancer";
|
|
|
|
longDescription = ''
|
|
|
|
HAProxy is a free, very fast and reliable solution offering high
|
|
|
|
availability, load balancing, and proxying for TCP and HTTP-based
|
|
|
|
applications. It is particularly suited for web sites crawling under very
|
|
|
|
high loads while needing persistence or Layer7 processing. Supporting
|
|
|
|
tens of thousands of connections is clearly realistic with todays
|
|
|
|
hardware.
|
|
|
|
'';
|
2019-11-08 04:25:03 +00:00
|
|
|
homepage = "https://haproxy.org";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ fuzzy-id ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
2012-05-18 08:50:10 +01:00
|
|
|
};
|
|
|
|
}
|