20 # nix has a problem with the `?` in the feature list
21 # enabling kafka will produce a vector with no features at all
23 # TODO investigate adding "vrl-cli" and various "vendor-*"
24 # "disk-buffer" is using leveldb TODO: investigate how useful
25 # it would be, perhaps only for massive scale?
26 , features ? ([ "api" "api-client" "sinks" "sources" "transforms" "vrl-cli" ]
27 # the second feature flag is passed to the rdkafka dependency
28 # building on linux fails without this feature flag (both x86_64 and AArch64)
29 ++ lib.optionals enableKafka [ "rdkafka?/gssapi-vendored" ]
30 ++ lib.optional stdenv.targetPlatform.isUnix "unix")
37 rustPlatform.buildRustPackage {
38 inherit pname version;
40 src = fetchFromGitHub {
41 owner = "vectordotdev";
44 hash = "sha256-2hCgHf7iBPl9BQITXyUDwgAz/i2HhXT4eczWrExCUDk=";
47 cargoHash = "sha256-E23m8/XCEXeEpz1itIzCit9RpoB1/PRrYVWxt+VVfxA=";
48 nativeBuildInputs = [ pkg-config cmake perl ];
49 buildInputs = [ oniguruma openssl protobuf rdkafka zstd ]
50 ++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
52 # needed for internal protobuf c wrapper library
53 PROTOC = "${protobuf}/bin/protoc";
54 PROTOC_INCLUDE = "${protobuf}/include";
55 RUSTONIG_SYSTEM_LIBONIG = true;
56 LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
58 TZDIR = "${tzdata}/share/zoneinfo";
60 # needed to dynamically link rdkafka
61 CARGO_FEATURE_DYNAMIC_LINKING=1;
63 buildNoDefaultFeatures = true;
64 buildFeatures = features;
66 # TODO investigate compilation failure for tests
67 # there are about 100 tests failing (out of 1100) for version 0.22.0
71 # tries to make a network access
72 "--skip=sinks::loki::tests::healthcheck_grafana_cloud"
74 # flaky on linux-aarch64
75 "--skip=kubernetes::api_watcher::tests::test_stream_errors"
77 # flaky on linux-x86_64
78 "--skip=sources::socket::test::tcp_with_tls_intermediate_ca"
79 "--skip=sources::host_metrics::cgroups::tests::generates_cgroups_metrics"
80 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events"
81 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events_gzip_request"
82 "--skip=sources::aws_kinesis_firehose::tests::handles_acknowledgement_failure"
85 # recent overhauls of DNS support in 0.9 mean that we try to resolve
86 # vector.dev during the checkPhase, which obviously isn't going to work.
87 # these tests in the DNS module are trivial though, so stubbing them out is
90 # the geoip transform yields maxmindb.so which contains references to rustc.
91 # neither figured out why the shared object is included in the output
92 # (it doesn't seem to be a runtime dependencies of the geoip transform),
93 # nor do I know why it depends on rustc.
94 # However, in order for the closure size to stay at a reasonable level,
95 # transforms-geoip is patched out of Cargo.toml for now - unless explicitly asked for.
97 substituteInPlace ./src/dns.rs \
98 --replace "#[tokio::test]" ""
100 ${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
101 substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
105 passthru = { inherit features; };
108 description = "A high-performance logs, metrics, and events router";
109 homepage = "https://github.com/timberio/vector";
110 license = with licenses; [ asl20 ];
111 maintainers = with maintainers; [ thoughtpolice happysalada ];
112 platforms = with platforms; all;