2021-11-23 00:28:20 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd }:
|
2019-05-03 20:46:53 +02:00
|
|
|
|
2019-10-29 10:20:00 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-05-03 20:46:53 +02:00
|
|
|
pname = "fluent-bit";
|
2021-10-29 17:16:12 +02:00
|
|
|
version = "1.8.9";
|
2019-05-03 20:46:53 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "fluent-bit";
|
2019-10-29 10:20:00 +01:00
|
|
|
rev = "v${version}";
|
2021-10-29 17:16:12 +02:00
|
|
|
sha256 = "sha256-b+MZuZQB/sl0HcioU1KCxH3TNiXYSPBfC9dBKqCVeXk=";
|
2019-05-03 20:46:53 +02:00
|
|
|
};
|
|
|
|
|
2021-11-21 03:13:12 +01:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
2021-11-23 00:28:20 +01:00
|
|
|
# Fix compilations errors on darwin
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/calyptia/cmetrics/commit/4f0f7ae2eeec148a69156f9fcc05d64bf249d11e.patch";
|
|
|
|
sha256 = "sha256-M1+28mHxpMvcFkOoKxkMMo1VCQsG33ncFZkFalOq2FQ=";
|
|
|
|
stripLen = 1;
|
|
|
|
extraPrefix = "lib/cmetrics/";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/calyptia/cmetrics/commit/a97999cb6d7299ef230d216b7a1c584b43c64de9.patch";
|
|
|
|
sha256 = "sha256-RuyPEeILc86n/klPIb334XpX0F71nskQ8s/ya0rE2zI=";
|
|
|
|
stripLen = 1;
|
|
|
|
extraPrefix = "lib/cmetrics/";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Fix bundled luajit compilation args
|
2021-11-21 03:13:12 +01:00
|
|
|
./fix-luajit-darwin.patch
|
|
|
|
];
|
|
|
|
|
2019-10-29 10:20:00 +01:00
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
2019-05-03 20:46:53 +02:00
|
|
|
|
2021-06-29 15:03:48 +02:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [ systemd ];
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" ];
|
|
|
|
|
2021-02-22 05:20:00 +01:00
|
|
|
# _FORTIFY_SOURCE requires compiling with optimization (-O)
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-O";
|
2020-11-03 00:52:05 +01:00
|
|
|
|
2021-06-29 15:03:48 +02:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2019-05-03 20:46:53 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/CMakeLists.txt \
|
|
|
|
--replace /lib/systemd $out/lib/systemd
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-05-03 20:46:53 +02:00
|
|
|
description = "Log forwarder and processor, part of Fluentd ecosystem";
|
|
|
|
homepage = "https://fluentbit.io";
|
2021-06-29 15:03:48 +02:00
|
|
|
maintainers = with maintainers; [ samrose fpletz ];
|
2019-05-03 20:46:53 +02:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|