2022-11-21 17:40:18 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, flex, bison, systemd, postgresql, openssl, libyaml }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fluent-bit";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "2.1.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "fluent-bit";
|
|
|
|
rev = "v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-PPpdGLzyivsLd6I7ER9llp6fdLgtWRwEkKzLko/ehro=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
buildInputs = [ openssl libyaml postgresql ]
|
2022-01-26 04:04:25 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ systemd ];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" "-DFLB_OUT_PGSQL=ON" ];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
# _FORTIFY_SOURCE requires compiling with optimization (-O)
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ "-O" ]
|
2022-06-16 17:23:12 +00:00
|
|
|
# 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
|
2023-03-04 12:14:45 +00:00
|
|
|
++ 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";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/fluent/fluent-bit/releases/tag/v${version}";
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ samrose fpletz ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2022-11-21 17:40:18 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|