2022-01-26 04:04:25 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, flex, bison, systemd, openssl }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fluent-bit";
|
2022-01-26 04:04:25 +00:00
|
|
|
version = "1.8.11";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fluent";
|
|
|
|
repo = "fluent-bit";
|
|
|
|
rev = "v${version}";
|
2022-01-26 04:04:25 +00:00
|
|
|
sha256 = "sha256-DULXfkddBdCvTWkuWXjSTEujRZ3mVVzy//qeB3j0Vz8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
|
|
|
# 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
|
|
|
|
./fix-luajit-darwin.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
|
|
|
|
2022-01-26 04:04:25 +00:00
|
|
|
buildInputs = [ openssl ]
|
|
|
|
++ 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)
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-O";
|
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;
|
|
|
|
};
|
|
|
|
}
|