]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add fluentd and fluent-bit
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 19 Aug 2021 23:34:34 +0000 (01:34 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 9 Apr 2023 15:14:21 +0000 (17:14 +0200)
pkgs/default.nix
pkgs/fluent-bit/default.nix [new file with mode: 0644]
pkgs/fluentd/Gemfile [new file with mode: 0644]
pkgs/fluentd/Gemfile.lock [new file with mode: 0644]
pkgs/fluentd/default.nix [new file with mode: 0644]
pkgs/fluentd/gemset.nix [new file with mode: 0644]

index 5f5df82d11e6f0e20ee7f9d7a0ee32c3b6a14305..13611ec8d5a637a50fda6258449ccca5de054612 100644 (file)
@@ -10,6 +10,8 @@ rec {
   cnagios = callPackage ./cnagios { inherit mylibs; };
   commento = callPackage ./commento {};
   flrn = callPackage ./flrn { inherit mylibs; slang = callPackage ./slang_1 {}; };
+  fluentd = callPackage ./fluentd {};
+  fluent-bit = callPackage ./fluent-bit {};
   genius = callPackage ./genius {};
   mtop = callPackage ./mtop {};
   muttprint = callPackage ./muttprint {};
diff --git a/pkgs/fluent-bit/default.nix b/pkgs/fluent-bit/default.nix
new file mode 100644 (file)
index 0000000..390223e
--- /dev/null
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitHub, cmake, flex, bison, pkg-config
+, systemd, openssl, postgresql }:
+
+stdenv.mkDerivation rec {
+  pname = "fluent-bit";
+  version = "1.8.3";
+
+  src = fetchFromGitHub {
+    owner = "fluent";
+    repo = "fluent-bit";
+    rev = "v${version}";
+    sha256 = "004x135imja67babmmpkk1jpp5xwhfa8cwg1svaas2asq6cnv77d";
+  };
+
+  nativeBuildInputs = [ cmake flex bison pkg-config postgresql ];
+
+  buildInputs = [ openssl ]
+    ++ lib.optionals stdenv.isLinux [ systemd ];
+
+  cmakeFlags = [ "-DFLB_METRICS=ON" "-DFLB_HTTP_SERVER=ON" "-DFLB_SQLDB=ON" "-DFLB_OUT_PGSQL=ON" "-DFLB_IN_SYSTEMD=ON" ];
+
+  patches = lib.optionals stdenv.isDarwin [ ./fix-luajit-darwin.patch ];
+
+  NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
+    # _FORTIFY_SOURCE requires compiling with optimization (-O)
+    "-O"
+    # Needed due to bundled mbedtls
+    "-Wno-error=format"
+    "-Wno-error=format-truncation"
+  ];
+
+
+  outputs = [ "out" "dev" ];
+
+  postPatch = ''
+    substituteInPlace src/CMakeLists.txt \
+      --replace /lib/systemd $out/lib/systemd
+  '';
+
+  meta = with lib; {
+    description = "Log forwarder and processor, part of Fluentd ecosystem";
+    homepage = "https://fluentbit.io";
+    maintainers = with maintainers; [ samrose fpletz ];
+    license = licenses.asl20;
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/fluentd/Gemfile b/pkgs/fluentd/Gemfile
new file mode 100644 (file)
index 0000000..71486df
--- /dev/null
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gem 'fluentd'
diff --git a/pkgs/fluentd/Gemfile.lock b/pkgs/fluentd/Gemfile.lock
new file mode 100644 (file)
index 0000000..3f022cf
--- /dev/null
@@ -0,0 +1,38 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    concurrent-ruby (1.1.9)
+    cool.io (1.7.1)
+    fluentd (1.13.3)
+      bundler
+      cool.io (>= 1.4.5, < 2.0.0)
+      http_parser.rb (>= 0.5.1, < 0.8.0)
+      msgpack (>= 1.3.1, < 2.0.0)
+      serverengine (>= 2.2.2, < 3.0.0)
+      sigdump (~> 0.2.2)
+      strptime (>= 0.2.2, < 1.0.0)
+      tzinfo (>= 1.0, < 3.0)
+      tzinfo-data (~> 1.0)
+      webrick (>= 1.4.2, < 1.8.0)
+      yajl-ruby (~> 1.0)
+    http_parser.rb (0.7.0)
+    msgpack (1.4.2)
+    serverengine (2.2.4)
+      sigdump (~> 0.2.2)
+    sigdump (0.2.4)
+    strptime (0.2.5)
+    tzinfo (2.0.4)
+      concurrent-ruby (~> 1.0)
+    tzinfo-data (1.2021.1)
+      tzinfo (>= 1.0.0)
+    webrick (1.7.0)
+    yajl-ruby (1.4.1)
+
+PLATFORMS
+  x86_64-linux
+
+DEPENDENCIES
+  fluentd
+
+BUNDLED WITH
+   2.2.20
diff --git a/pkgs/fluentd/default.nix b/pkgs/fluentd/default.nix
new file mode 100644 (file)
index 0000000..f6a22f0
--- /dev/null
@@ -0,0 +1,20 @@
+{ ruby, bundlerEnv, bundlerUpdateScript, lib }:
+
+bundlerEnv {
+  inherit ruby;
+
+  pname = "fluentd";
+  gemdir = ./.;
+
+  passthru.updateScript = bundlerUpdateScript "fluentd";
+
+  copyGemFiles = true;
+
+  meta = with lib; {
+    description = "A data collector";
+    homepage    = "https://www.fluentd.org/";
+    license     = licenses.asl20;
+    maintainers = with maintainers; [ offline nicknovitski ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/pkgs/fluentd/gemset.nix b/pkgs/fluentd/gemset.nix
new file mode 100644 (file)
index 0000000..8ee42b6
--- /dev/null
@@ -0,0 +1,126 @@
+{
+  concurrent-ruby = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0nwad3211p7yv9sda31jmbyw6sdafzmdi2i2niaz6f0wk5nq9h0f";
+      type = "gem";
+    };
+    version = "1.1.9";
+  };
+  "cool.io" = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0dfq4h168wzvs9cvn2mm8648ynkl936pgjva2p8ik34p6d620537";
+      type = "gem";
+    };
+    version = "1.7.1";
+  };
+  fluentd = {
+    dependencies = ["cool.io" "http_parser.rb" "msgpack" "serverengine" "sigdump" "strptime" "tzinfo" "tzinfo-data" "webrick" "yajl-ruby"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "12k9b9903x5fi3lqb41h20qx8s0fwx7chjldbxmyi7j1x6xdm7cv";
+      type = "gem";
+    };
+    version = "1.13.3";
+  };
+  "http_parser.rb" = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1xha614fi6l04wryqjj1xmpalzlmhb6lb9qmlh8mmliycdhvcshp";
+      type = "gem";
+    };
+    version = "0.7.0";
+  };
+  msgpack = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "06iajjyhx0rvpn4yr3h1hc4w4w3k59bdmfhxnjzzh76wsrdxxrc6";
+      type = "gem";
+    };
+    version = "1.4.2";
+  };
+  serverengine = {
+    dependencies = ["sigdump"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1gzhggx40a53mnv4f32xag4h6ai0s5m3w06s59b0h6ih7rqvwns9";
+      type = "gem";
+    };
+    version = "2.2.4";
+  };
+  sigdump = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1mqf06iw7rymv54y7rgbmfi6ppddgjjmxzi3hrw658n1amp1gwhb";
+      type = "gem";
+    };
+    version = "0.2.4";
+  };
+  strptime = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1ycs0xz58kymf7yp4h56f0nid2z7g3s18dj7pa3p790pfzzpgvcq";
+      type = "gem";
+    };
+    version = "0.2.5";
+  };
+  tzinfo = {
+    dependencies = ["concurrent-ruby"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "10qp5x7f9hvlc0psv9gsfbxg4a7s0485wsbq1kljkxq94in91l4z";
+      type = "gem";
+    };
+    version = "2.0.4";
+  };
+  tzinfo-data = {
+    dependencies = ["tzinfo"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0ik16lnsyr2739jzwl4r5sz8q639lqw8f9s68iszwhm2pcq8p4w2";
+      type = "gem";
+    };
+    version = "1.2021.1";
+  };
+  webrick = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1d4cvgmxhfczxiq5fr534lmizkhigd15bsx5719r5ds7k7ivisc7";
+      type = "gem";
+    };
+    version = "1.7.0";
+  };
+  yajl-ruby = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "16v0w5749qjp13xhjgr2gcsvjv6mf35br7iqwycix1n2h7kfcckf";
+      type = "gem";
+    };
+    version = "1.4.1";
+  };
+}
\ No newline at end of file