at 23.05-pre 3.9 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, fetchpatch 5, rustPlatform 6, pkg-config 7, llvmPackages 8, openssl 9, protobuf 10, rdkafka 11, oniguruma 12, zstd 13, Security 14, libiconv 15, coreutils 16, CoreServices 17, tzdata 18, cmake 19, perl 20 # nix has a problem with the `?` in the feature list 21 # enabling kafka will produce a vector with no features at all 22, enableKafka ? false 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") 31}: 32 33let 34 pname = "vector"; 35 version = "0.25.1"; 36in 37rustPlatform.buildRustPackage { 38 inherit pname version; 39 40 src = fetchFromGitHub { 41 owner = "vectordotdev"; 42 repo = pname; 43 rev = "v${version}"; 44 hash = "sha256-7iYiSO966o0M9M0ijGCpuRVRgus+tURLBN9S5lPDRb8="; 45 }; 46 47 cargoHash = "sha256-EqK6r/pFFKmnpPPUhqdC3bztYQZ+2w7u7V8Rj+9oWII="; 48 nativeBuildInputs = [ pkg-config cmake perl ]; 49 buildInputs = [ oniguruma openssl protobuf rdkafka zstd ] 50 ++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ]; 51 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"; 57 58 TZDIR = "${tzdata}/share/zoneinfo"; 59 60 # needed to dynamically link rdkafka 61 CARGO_FEATURE_DYNAMIC_LINKING=1; 62 63 buildNoDefaultFeatures = true; 64 buildFeatures = features; 65 66 # TODO investigate compilation failure for tests 67 # there are about 100 tests failing (out of 1100) for version 0.22.0 68 doCheck = false; 69 70 checkFlags = [ 71 # tries to make a network access 72 "--skip=sinks::loki::tests::healthcheck_grafana_cloud" 73 74 # flaky on linux-aarch64 75 "--skip=kubernetes::api_watcher::tests::test_stream_errors" 76 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" 83 ]; 84 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 88 # fine IMO. 89 # 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. 96 postPatch = '' 97 substituteInPlace ./src/dns.rs \ 98 --replace "#[tokio::test]" "" 99 100 ${lib.optionalString (!builtins.elem "transforms-geoip" features) '' 101 substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' "" 102 ''} 103 ''; 104 105 passthru = { inherit features; }; 106 107 meta = with lib; { 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; 113 }; 114} 115