at 24.05-pre 4.6 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, rustPlatform 5, pkg-config 6, openssl 7, protobuf 8, rdkafka 9, oniguruma 10, zstd 11, rust-jemalloc-sys 12, Security 13, libiconv 14, coreutils 15, CoreServices 16, tzdata 17, cmake 18, perl 19, git 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 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" "enrichment-tables" "sinks" "sources" "sources-dnstap" "transforms" "component-validation-runner" ] 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.hostPlatform.isUnix "unix") 31, nixosTests 32, nix-update-script 33}: 34 35let 36 pname = "vector"; 37 version = "0.34.1"; 38in 39rustPlatform.buildRustPackage { 40 inherit pname version; 41 42 src = fetchFromGitHub { 43 owner = "vectordotdev"; 44 repo = pname; 45 rev = "v${version}"; 46 hash = "sha256-vK+k+VbUVgJ8idlvuod5ExAkkeTYDk/135dyLRct0zs="; 47 }; 48 49 patches = [ ./vector-pr19075.patch ]; 50 51 cargoLock = { 52 lockFile = ./Cargo.lock; 53 outputHashes = { 54 "aws-config-0.54.1" = "sha256-AVumLhybVbMnEah9/JqiQOQ4R0e2OsbB8WAJ422R6uk="; 55 "greptime-proto-0.1.0" = "sha256-kSOy/0s8ZJ1RfqOb469oaVlreABtHxesNaMzFH6H+aE="; 56 "greptimedb-client-0.1.0" = "sha256-mGgbxp/h55snowS2BV+QRwrhnE5vywfRF9Gc+8MoAdY="; 57 "heim-0.1.0-rc.1" = "sha256-ODKEQ1udt7FlxI5fvoFMG7C2zmM45eeEYDUEaLTsdYo="; 58 "nix-0.26.2" = "sha256-uquYvRT56lhupkrESpxwKEimRFhmYvri10n3dj0f2yg="; 59 "ntapi-0.3.7" = "sha256-G6ZCsa3GWiI/FeGKiK9TWkmTxen7nwpXvm5FtjNtjWU="; 60 "tokio-util-0.7.8" = "sha256-HCvtfohOoa1ZjD4s7QLDbIV4fe/MVBKtgM1QQX7gGKQ="; 61 "tracing-0.2.0" = "sha256-YAxeEofFA43PX2hafh3RY+C81a2v6n1fGzYz2FycC3M="; 62 }; 63 }; 64 nativeBuildInputs = [ pkg-config cmake perl git rustPlatform.bindgenHook ]; 65 buildInputs = [ oniguruma openssl protobuf rdkafka zstd rust-jemalloc-sys ] 66 ++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ]; 67 68 # needed for internal protobuf c wrapper library 69 PROTOC = "${protobuf}/bin/protoc"; 70 PROTOC_INCLUDE = "${protobuf}/include"; 71 RUSTONIG_SYSTEM_LIBONIG = true; 72 73 TZDIR = "${tzdata}/share/zoneinfo"; 74 75 # needed to dynamically link rdkafka 76 CARGO_FEATURE_DYNAMIC_LINKING=1; 77 78 buildNoDefaultFeatures = true; 79 buildFeatures = features; 80 81 # TODO investigate compilation failure for tests 82 # there are about 100 tests failing (out of 1100) for version 0.22.0 83 doCheck = false; 84 85 checkFlags = [ 86 # tries to make a network access 87 "--skip=sinks::loki::tests::healthcheck_grafana_cloud" 88 89 # flaky on linux-aarch64 90 "--skip=kubernetes::api_watcher::tests::test_stream_errors" 91 92 # flaky on linux-x86_64 93 "--skip=sources::socket::test::tcp_with_tls_intermediate_ca" 94 "--skip=sources::host_metrics::cgroups::tests::generates_cgroups_metrics" 95 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events" 96 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events_gzip_request" 97 "--skip=sources::aws_kinesis_firehose::tests::handles_acknowledgement_failure" 98 ]; 99 100 # recent overhauls of DNS support in 0.9 mean that we try to resolve 101 # vector.dev during the checkPhase, which obviously isn't going to work. 102 # these tests in the DNS module are trivial though, so stubbing them out is 103 # fine IMO. 104 # 105 # the geoip transform yields maxmindb.so which contains references to rustc. 106 # neither figured out why the shared object is included in the output 107 # (it doesn't seem to be a runtime dependencies of the geoip transform), 108 # nor do I know why it depends on rustc. 109 # However, in order for the closure size to stay at a reasonable level, 110 # transforms-geoip is patched out of Cargo.toml for now - unless explicitly asked for. 111 postPatch = '' 112 substituteInPlace ./src/dns.rs \ 113 --replace "#[tokio::test]" "" 114 ''; 115 116 passthru = { 117 inherit features; 118 tests = { inherit (nixosTests) vector; }; 119 updateScript = nix-update-script { }; 120 }; 121 122 meta = with lib; { 123 description = "A high-performance observability data pipeline"; 124 homepage = "https://github.com/vectordotdev/vector"; 125 license = licenses.mpl20; 126 maintainers = with maintainers; [ thoughtpolice happysalada ]; 127 platforms = with platforms; all; 128 mainProgram = "vector"; 129 }; 130}