2023-07-15 17:15:38 +00:00
|
|
|
{ useLua ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
, usePcre ? true
|
|
|
|
, withPrometheusExporter ? true
|
2023-08-04 22:07:22 +00:00
|
|
|
, stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
, openssl
|
|
|
|
, zlib
|
|
|
|
, libxcrypt
|
|
|
|
, lua5_3 ? null
|
|
|
|
, pcre ? null
|
|
|
|
, systemd ? null
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert useLua -> lua5_3 != null;
|
|
|
|
assert usePcre -> pcre != null;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "haproxy";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.8.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-08-04 22:07:22 +00:00
|
|
|
url = "https://www.haproxy.org/download/${lib.versions.majorMinor finalAttrs.version}/src/haproxy-${finalAttrs.version}.tar.gz";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-gbrL9Q7G0Pfsqq18A+WZeLADIvva1u1KmJ3TF1S28l0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
buildInputs = [ openssl zlib libxcrypt ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional useLua lua5_3
|
|
|
|
++ lib.optional usePcre pcre
|
|
|
|
++ lib.optional stdenv.isLinux systemd;
|
|
|
|
|
|
|
|
# TODO: make it work on bsd as well
|
|
|
|
makeFlags = [
|
2022-03-10 19:12:11 +00:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2023-08-04 22:07:22 +00:00
|
|
|
("TARGET=" + (if stdenv.isSunOS then "solaris"
|
|
|
|
else if stdenv.isLinux then "linux-glibc"
|
|
|
|
else if stdenv.isDarwin then "osx"
|
|
|
|
else "generic"))
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"USE_OPENSSL=yes"
|
|
|
|
"USE_ZLIB=yes"
|
|
|
|
] ++ lib.optionals usePcre [
|
|
|
|
"USE_PCRE=yes"
|
|
|
|
"USE_PCRE_JIT=yes"
|
|
|
|
] ++ lib.optionals useLua [
|
|
|
|
"USE_LUA=yes"
|
2021-05-20 23:08:51 +00:00
|
|
|
"LUA_LIB_NAME=lua"
|
2020-04-24 23:36:52 +00:00
|
|
|
"LUA_LIB=${lua5_3}/lib"
|
|
|
|
"LUA_INC=${lua5_3}/include"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"USE_SYSTEMD=yes"
|
|
|
|
"USE_GETADDRINFO=1"
|
|
|
|
] ++ lib.optionals withPrometheusExporter [
|
2022-02-10 20:34:41 +00:00
|
|
|
"USE_PROMEX=yes"
|
2021-02-19 19:06:45 +00:00
|
|
|
] ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
passthru.tests.haproxy = nixosTests.haproxy;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
meta = {
|
|
|
|
changelog = "https://www.haproxy.org/download/${lib.versions.majorMinor finalAttrs.version}/src/CHANGELOG";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Reliable, high performance TCP/HTTP load balancer";
|
2023-08-04 22:07:22 +00:00
|
|
|
homepage = "https://haproxy.org";
|
|
|
|
license = with lib.licenses; [ gpl2Plus lgpl21Only ];
|
2020-04-24 23:36:52 +00:00
|
|
|
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.
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with lib.maintainers; [ ];
|
|
|
|
platforms = with lib.platforms; linux ++ darwin;
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "haproxy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-08-04 22:07:22 +00:00
|
|
|
})
|