2022-11-07 22:01:46 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, flex, bison, systemd, postgresql, openssl, libyaml }:
|
2019-05-03 18:46:53 +00:00
|
|
|
|
2019-10-29 09:20:00 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-05-03 18:46:53 +00:00
|
|
|
pname = "fluent-bit";
|
2022-11-26 05:53:35 +00:00
|
|
|
version = "2.0.6";
|
2019-05-03 18:46:53 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "fluent-bit";
|
2019-10-29 09:20:00 +00:00
|
|
|
rev = "v${version}";
|
2022-11-26 05:53:35 +00:00
|
|
|
sha256 = "sha256-DUMsNuu1sdtkWCX5yweFcjbRcDRHhZYLku4mTmQqXDk=";
|
2019-05-03 18:46:53 +00:00
|
|
|
};
|
|
|
|
|
2019-10-29 09:20:00 +00:00
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
2019-05-03 18:46:53 +00:00
|
|
|
|
2022-11-07 22:01:46 +00:00
|
|
|
buildInputs = [ openssl libyaml postgresql ]
|
2022-01-25 15:01:03 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ systemd ];
|
2021-06-29 13:03:48 +00:00
|
|
|
|
2022-11-07 22:01:46 +00:00
|
|
|
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" "-DFLB_OUT_PGSQL=ON" ];
|
2021-06-29 13:03:48 +00:00
|
|
|
|
2021-02-22 04:20:00 +00:00
|
|
|
# _FORTIFY_SOURCE requires compiling with optimization (-O)
|
2022-06-10 08:26:07 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-O" ]
|
|
|
|
# Workaround build failure on -fno-common toolchains:
|
|
|
|
# ld: /monkey/mk_tls.h:81: multiple definition of `mk_tls_server_timeout';
|
|
|
|
# flb_config.c.o:include/monkey/mk_tls.h:81: first defined here
|
|
|
|
# TODO: drop when upstream gets a fix for it:
|
|
|
|
# https://github.com/fluent/fluent-bit/issues/5537
|
|
|
|
++ lib.optionals stdenv.isDarwin [ "-fcommon" ];
|
2020-11-02 23:52:05 +00:00
|
|
|
|
2021-06-29 13:03:48 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2019-05-03 18:46:53 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/CMakeLists.txt \
|
|
|
|
--replace /lib/systemd $out/lib/systemd
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-05-03 18:46:53 +00:00
|
|
|
description = "Log forwarder and processor, part of Fluentd ecosystem";
|
|
|
|
homepage = "https://fluentbit.io";
|
2021-06-29 13:03:48 +00:00
|
|
|
maintainers = with maintainers; [ samrose fpletz ];
|
2019-05-03 18:46:53 +00:00
|
|
|
license = licenses.asl20;
|
2022-11-10 22:55:06 +00:00
|
|
|
platforms = platforms.linux;
|
2019-05-03 18:46:53 +00:00
|
|
|
};
|
|
|
|
}
|