nixpkgs/pkgs/tools/networking/haproxy/default.nix
Vincent Bernat bf1473f5e0 haproxy: use getaddrinfo() on Linux (#44489)
As per project's README:

> Recent systems can resolve IPv6 host names using getaddrinfo(). This
> primitive is not present in all libcs and does not work in all of
> them either. Support in glibc was broken before 2.3. Some embedded
> libs may not properly work either, thus, support is disabled by
> default, meaning that some host names which only resolve as IPv6
> addresses will not resolve and configs might emit an error during
> parsing. If you know that your OS libc has reliable support for
> getaddrinfo(), you can add USE_GETADDRINFO=1 on the make command
> line to enable it. This is the recommended option for most Linux
> distro packagers since it's working fine on all recent mainstream
> distros. It is automatically enabled on Solaris 8 and above, as it's
> known to work.

Without this option, it is not possible for HAProxy to solve IPv6-only
names. This option is enabled in Debian builds without any notable
adverse effect.
2018-08-05 18:17:27 +02:00

61 lines
1.9 KiB
Nix

{ useLua ? !stdenv.isDarwin
, usePcre ? true
, stdenv, fetchurl
, openssl, zlib, lua5_3 ? null, pcre ? null
}:
assert useLua -> lua5_3 != null;
assert usePcre -> pcre != null;
stdenv.mkDerivation rec {
pname = "haproxy";
version = "1.8.13";
name = "${pname}-${version}";
src = fetchurl {
url = "https://www.haproxy.org/download/${stdenv.lib.versions.majorMinor version}/src/${name}.tar.gz";
sha256 = "2bf5dafbb5f1530c0e67ab63666565de948591f8e0ee2a1d3c84c45e738220f1";
};
buildInputs = [ openssl zlib ]
++ stdenv.lib.optional useLua lua5_3
++ stdenv.lib.optional usePcre pcre;
# TODO: make it work on bsd as well
makeFlags = [
"PREFIX=\${out}"
("TARGET=" + (if stdenv.isSunOS then "solaris"
else if stdenv.isLinux then "linux2628"
else if stdenv.isDarwin then "osx"
else "generic"))
];
buildFlags = [
"USE_OPENSSL=yes"
"USE_ZLIB=yes"
] ++ stdenv.lib.optionals usePcre [
"USE_PCRE=yes"
"USE_PCRE_JIT=yes"
] ++ stdenv.lib.optionals useLua [
"USE_LUA=yes"
"LUA_LIB=${lua5_3}/lib"
"LUA_INC=${lua5_3}/include"
] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc"
++ stdenv.lib.optional stdenv.isLinux "USE_GETADDRINFO=1";
meta = {
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.
'';
homepage = http://haproxy.1wt.eu;
maintainers = with stdenv.lib.maintainers; [ fuzzy-id garbas ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
license = stdenv.lib.licenses.gpl2;
};
}