2021-04-05 15:23:46 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
, pkg-config
|
2021-06-28 23:13:55 +00:00
|
|
|
, llvmPackages
|
|
|
|
, openssl
|
2021-04-05 15:23:46 +00:00
|
|
|
, protobuf
|
2021-06-28 23:13:55 +00:00
|
|
|
, rdkafka
|
|
|
|
, oniguruma
|
|
|
|
, zstd
|
2021-04-05 15:23:46 +00:00
|
|
|
, Security
|
|
|
|
, libiconv
|
2020-10-11 12:50:04 +00:00
|
|
|
, coreutils
|
|
|
|
, CoreServices
|
2021-06-28 23:13:55 +00:00
|
|
|
, tzdata
|
2022-01-03 16:56:52 +00:00
|
|
|
, cmake
|
2022-04-15 01:41:22 +00:00
|
|
|
, perl
|
2021-06-28 23:13:55 +00:00
|
|
|
# kafka is optional but one of the most used features
|
|
|
|
, enableKafka ? true
|
|
|
|
# TODO investigate adding "api" "api-client" "vrl-cli" and various "vendor-*"
|
|
|
|
# "disk-buffer" is using leveldb TODO: investigate how useful
|
|
|
|
# it would be, perhaps only for massive scale?
|
2022-04-27 09:35:20 +00:00
|
|
|
, features ? ([ "sinks" "sources" "transforms" "vrl-cli" ]
|
2021-06-28 23:13:55 +00:00
|
|
|
# the second feature flag is passed to the rdkafka dependency
|
|
|
|
# building on linux fails without this feature flag (both x86_64 and AArch64)
|
2022-07-14 12:49:19 +00:00
|
|
|
++ lib.optionals enableKafka [ "rdkafka?/gssapi-vendored" ]
|
2021-12-06 16:07:01 +00:00
|
|
|
++ lib.optional stdenv.targetPlatform.isUnix "unix")
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "vector";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "0.23.0";
|
2021-10-28 06:52:43 +00:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
inherit pname version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-06-26 10:26:21 +00:00
|
|
|
owner = "vectordotdev";
|
2021-04-05 15:23:46 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-07-14 12:49:19 +00:00
|
|
|
sha256 = "sha256-Y1RysuCWvdbqckW54r1uH/K9YTuAZk8T4M3HRGFm0EM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
cargoSha256 = "sha256-VBmJfRCwSv3t5DPzVj92ajGYk5Ju8xqr4v7IDU17498=";
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake perl ];
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = [ oniguruma openssl protobuf rdkafka zstd ]
|
2021-08-08 23:34:03 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# needed for internal protobuf c wrapper library
|
2021-04-05 15:23:46 +00:00
|
|
|
PROTOC = "${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE = "${protobuf}/include";
|
2021-06-28 23:13:55 +00:00
|
|
|
RUSTONIG_SYSTEM_LIBONIG = true;
|
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
TZDIR = "${tzdata}/share/zoneinfo";
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# needed to dynamically link rdkafka
|
|
|
|
CARGO_FEATURE_DYNAMIC_LINKING=1;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
buildFeatures = features;
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# TODO investigate compilation failure for tests
|
2022-06-16 17:23:12 +00:00
|
|
|
# there are about 100 tests failing (out of 1100) for version 0.22.0
|
2022-04-27 09:35:20 +00:00
|
|
|
doCheck = false;
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
# tries to make a network access
|
|
|
|
"--skip=sinks::loki::tests::healthcheck_grafana_cloud"
|
|
|
|
|
|
|
|
# flaky on linux-aarch64
|
|
|
|
"--skip=kubernetes::api_watcher::tests::test_stream_errors"
|
|
|
|
|
|
|
|
# flaky on linux-x86_64
|
|
|
|
"--skip=sources::socket::test::tcp_with_tls_intermediate_ca"
|
|
|
|
"--skip=sources::host_metrics::cgroups::tests::generates_cgroups_metrics"
|
2022-01-27 00:19:43 +00:00
|
|
|
"--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events"
|
|
|
|
"--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events_gzip_request"
|
|
|
|
"--skip=sources::aws_kinesis_firehose::tests::handles_acknowledgement_failure"
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
# recent overhauls of DNS support in 0.9 mean that we try to resolve
|
|
|
|
# vector.dev during the checkPhase, which obviously isn't going to work.
|
|
|
|
# these tests in the DNS module are trivial though, so stubbing them out is
|
|
|
|
# fine IMO.
|
2020-11-12 09:05:59 +00:00
|
|
|
#
|
|
|
|
# the geoip transform yields maxmindb.so which contains references to rustc.
|
|
|
|
# neither figured out why the shared object is included in the output
|
|
|
|
# (it doesn't seem to be a runtime dependencies of the geoip transform),
|
|
|
|
# nor do I know why it depends on rustc.
|
|
|
|
# However, in order for the closure size to stay at a reasonable level,
|
|
|
|
# transforms-geoip is patched out of Cargo.toml for now - unless explicitly asked for.
|
2021-04-05 15:23:46 +00:00
|
|
|
postPatch = ''
|
2020-10-11 12:50:04 +00:00
|
|
|
substituteInPlace ./src/dns.rs \
|
2021-04-05 15:23:46 +00:00
|
|
|
--replace "#[tokio::test]" ""
|
2020-11-12 09:05:59 +00:00
|
|
|
|
|
|
|
${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
|
|
|
|
substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
|
|
|
|
''}
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
passthru = { inherit features; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A high-performance logs, metrics, and events router";
|
2021-04-05 15:23:46 +00:00
|
|
|
homepage = "https://github.com/timberio/vector";
|
|
|
|
license = with licenses; [ asl20 ];
|
2020-12-03 08:41:04 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice happysalada ];
|
2022-04-27 09:35:20 +00:00
|
|
|
platforms = with platforms; linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|