Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haproxy: PCRE and LUA support via configurable options #24380

Merged
merged 3 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
ftrvxmtrx = "Siarhei Zirukin <ftrvxmtrx@gmail.com>";
funfunctor = "Edward O'Callaghan <eocallaghan@alterapraxis.com>";
fuuzetsu = "Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>";
fuzzy-id = "Thomas Bach <hacking+nixos@babibo.de>";
fxfactorial = "Edgar Aroutiounian <edgar.factorial@gmail.com>";
gal_bolle = "Florent Becker <florent.becker@ens-lyon.org>";
garbas = "Rok Garbas <rok@garbas.si>";
Expand Down
36 changes: 30 additions & 6 deletions pkgs/tools/networking/haproxy/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{ stdenv, pkgs, fetchurl, openssl, zlib }:
{ 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";
Expand All @@ -12,12 +19,29 @@ stdenv.mkDerivation rec {
sha256 = "ebb31550a5261091034f1b6ac7f4a8b9d79a8ce2a3ddcd7be5b5eb355c35ba65";
};

buildInputs = [ openssl zlib ];
buildInputs = [ openssl zlib ]
++ stdenv.lib.optional useLua lua5_3
++ stdenv.lib.optional usePcre pcre;

# TODO: make it work on bsd as well
preConfigure = ''
export makeFlags="TARGET=${if stdenv.isSunOS then "solaris" else if stdenv.isLinux then "linux2628" else "generic"} PREFIX=$out USE_OPENSSL=yes USE_ZLIB=yes ${stdenv.lib.optionalString stdenv.isDarwin "CC=cc USE_KQUEUE=1"}"
'';
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";

meta = {
description = "Reliable, high performance TCP/HTTP load balancer";
Expand All @@ -30,7 +54,7 @@ stdenv.mkDerivation rec {
hardware.
'';
homepage = http://haproxy.1wt.eu;
maintainers = [ stdenv.lib.maintainers.garbas ];
maintainers = with stdenv.lib.maintainers; [ fuzzy-id garbas ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
license = stdenv.lib.licenses.gpl2;
};
Expand Down