nixpkgs/pkgs/tools/networking/haproxy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.2 KiB
Nix
Raw Normal View History

{ useLua ? !stdenv.isDarwin
, usePcre ? true
2019-11-08 04:25:03 +00:00
, withPrometheusExporter ? true
2020-11-14 04:20:00 +00:00
, stdenv, lib, fetchurl, nixosTests
2019-11-08 04:25:03 +00:00
, openssl, zlib
, lua5_3 ? null, pcre ? null, systemd ? null
}:
assert useLua -> lua5_3 != null;
assert usePcre -> pcre != null;
stdenv.mkDerivation rec {
2017-01-26 08:37:51 +00:00
pname = "haproxy";
2022-07-31 14:59:48 +00:00
version = "2.6.2";
2013-10-29 14:55:25 +00:00
src = fetchurl {
2021-01-15 09:19:50 +00:00
url = "https://www.haproxy.org/download/${lib.versions.majorMinor version}/src/${pname}-${version}.tar.gz";
2022-07-31 14:59:48 +00:00
sha256 = "sha256-+bfcBuAusTtdlNxm4IZKcUruKvnfqxD6NT/58fUsggI=";
};
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;
2017-03-07 17:50:45 +00:00
# TODO: make it work on bsd as well
makeFlags = [
"PREFIX=${placeholder "out"}"
("TARGET=" + (if stdenv.isSunOS then "solaris"
2019-11-08 04:25:03 +00:00
else if stdenv.isLinux then "linux-glibc"
else if stdenv.isDarwin then "osx"
else "generic"))
];
2019-11-08 04:25:03 +00:00
buildFlags = [
"USE_OPENSSL=yes"
"USE_ZLIB=yes"
2019-11-08 04:25:03 +00:00
] ++ lib.optionals usePcre [
"USE_PCRE=yes"
"USE_PCRE_JIT=yes"
2019-11-08 04:25:03 +00:00
] ++ lib.optionals useLua [
"USE_LUA=yes"
2021-05-07 21:07:59 +00:00
"LUA_LIB_NAME=lua"
"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 [
"USE_PROMEX=yes"
] ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
2019-11-08 04:25:03 +00:00
enableParallelBuilding = true;
2020-11-14 04:20:00 +00:00
passthru.tests.haproxy = nixosTests.haproxy;
2019-11-08 04:25:03 +00:00
meta = with lib; {
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";
changelog = "https://www.haproxy.org/download/${lib.versions.majorMinor version}/src/CHANGELOG";
license = with licenses; [ gpl2Plus lgpl21Only ];
maintainers = with maintainers; [ ];
2019-11-08 04:25:03 +00:00
platforms = with platforms; linux ++ darwin;
};
}