2022-08-21 13:32:41 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, flex, bison, systemd, openssl, libyaml }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fluent-bit";
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "2.0.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "fluent-bit";
|
|
|
|
rev = "v${version}";
|
2022-11-04 12:27:35 +00:00
|
|
|
sha256 = "sha256-8P28xaFyaU0GrIrO+D+Rp9H4xgOymHtbAbd2mI79vSI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
buildInputs = [ openssl libyaml ]
|
2022-01-26 04:04:25 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ systemd ];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" ];
|
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
# _FORTIFY_SOURCE requires compiling with optimization (-O)
|
2022-06-16 17:23:12 +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-09 15:59:12 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/CMakeLists.txt \
|
|
|
|
--replace /lib/systemd $out/lib/systemd
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Log forwarder and processor, part of Fluentd ecosystem";
|
|
|
|
homepage = "https://fluentbit.io";
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ samrose fpletz ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|