base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / fl / fluent-bit / package.nix
blob8c6c762e66c34b34e3588a99c50adcb5a6e00f5a
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   flex,
7   bison,
8   systemd,
9   postgresql,
10   openssl,
11   libyaml,
12   darwin,
15 stdenv.mkDerivation (finalAttrs: {
16   pname = "fluent-bit";
17   version = "3.1.10";
19   src = fetchFromGitHub {
20     owner = "fluent";
21     repo = "fluent-bit";
22     rev = "v${finalAttrs.version}";
23     hash = "sha256-/YKXWYaDqkJ8fWgcYktXWJPcjDJTupgRTSQVp0cWruY=";
24   };
26   # optional only to avoid linux rebuild
27   patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./macos-11-sdk-compat.patch ];
29   nativeBuildInputs = [
30     cmake
31     flex
32     bison
33   ];
35   buildInputs =
36     [
37       openssl
38       libyaml
39       postgresql
40     ]
41     ++ lib.optionals stdenv.hostPlatform.isLinux [ systemd ]
42     ++ lib.optionals stdenv.hostPlatform.isDarwin [
43       darwin.apple_sdk_11_0.frameworks.IOKit
44       darwin.apple_sdk_11_0.frameworks.Foundation
45     ];
47   cmakeFlags = [
48     "-DFLB_RELEASE=ON"
49     "-DFLB_METRICS=ON"
50     "-DFLB_HTTP_SERVER=ON"
51     "-DFLB_OUT_PGSQL=ON"
52   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13" ];
54   env.NIX_CFLAGS_COMPILE = toString (
55     # Used by the embedded luajit, but is not predefined on older mac SDKs.
56     lib.optionals stdenv.hostPlatform.isDarwin [ "-DTARGET_OS_IPHONE=0" ]
57     # Assumes GNU version of strerror_r, and the posix version has an
58     # incompatible return type.
59     ++ lib.optionals (!stdenv.hostPlatform.isGnu) [ "-Wno-int-conversion" ]
60   );
62   outputs = [
63     "out"
64     "dev"
65   ];
67   postPatch = ''
68     substituteInPlace src/CMakeLists.txt \
69       --replace /lib/systemd $out/lib/systemd
70   '';
72   meta = {
73     changelog = "https://github.com/fluent/fluent-bit/releases/tag/v${finalAttrs.version}";
74     description = "Log forwarder and processor, part of Fluentd ecosystem";
75     homepage = "https://fluentbit.io";
76     license = lib.licenses.asl20;
77     maintainers = with lib.maintainers; [
78       samrose
79       fpletz
80     ];
81     platforms = lib.platforms.unix;
82   };