at master 134 lines 3.7 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 fetchpatch, 6 rustPlatform, 7 pkg-config, 8 openssl, 9 protobuf, 10 rdkafka, 11 oniguruma, 12 zstd, 13 rust-jemalloc-sys, 14 rust-jemalloc-sys-unprefixed, 15 libiconv, 16 coreutils, 17 tzdata, 18 cmake, 19 perl, 20 git, 21 nixosTests, 22 nix-update-script, 23 darwin, 24 zlib, 25}: 26 27rustPlatform.buildRustPackage (finalAttrs: { 28 pname = "vector"; 29 version = "0.50.0"; 30 31 src = fetchFromGitHub { 32 owner = "vectordotdev"; 33 repo = "vector"; 34 tag = "v${finalAttrs.version}"; 35 hash = "sha256-vyRvBCpWOKeI7Y+RbxCdVCAF45vWjC7ZD4PCS0QloPg="; 36 }; 37 38 cargoHash = "sha256-4Nsq5Ta08wlHuevOfrr1mPi+qY+49q9S+AtbY35sfEM="; 39 40 nativeBuildInputs = [ 41 pkg-config 42 cmake 43 perl 44 git 45 rustPlatform.bindgenHook 46 ] 47 # Provides the mig command used by the build scripts 48 ++ lib.optional stdenv.hostPlatform.isDarwin darwin.bootstrap_cmds; 49 buildInputs = [ 50 oniguruma 51 openssl 52 protobuf 53 rdkafka 54 zstd 55 ] 56 ++ lib.optionals stdenv.hostPlatform.isLinux [ rust-jemalloc-sys-unprefixed ] 57 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 58 rust-jemalloc-sys 59 libiconv 60 coreutils 61 zlib 62 ]; 63 64 # Without this, we get SIGSEGV failure 65 RUST_MIN_STACK = 33554432; 66 67 # needed for internal protobuf c wrapper library 68 PROTOC = "${protobuf}/bin/protoc"; 69 PROTOC_INCLUDE = "${protobuf}/include"; 70 RUSTONIG_SYSTEM_LIBONIG = true; 71 72 TZDIR = "${tzdata}/share/zoneinfo"; 73 74 # needed to dynamically link rdkafka 75 CARGO_FEATURE_DYNAMIC_LINKING = 1; 76 77 CARGO_PROFILE_RELEASE_LTO = "fat"; 78 CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; 79 80 # TODO investigate compilation failure for tests 81 # there are about 100 tests failing (out of 1100) for version 0.22.0 82 doCheck = false; 83 84 checkFlags = [ 85 # tries to make a network access 86 "--skip=sinks::loki::tests::healthcheck_grafana_cloud" 87 88 # flaky on linux-aarch64 89 "--skip=kubernetes::api_watcher::tests::test_stream_errors" 90 91 # flaky on linux-x86_64 92 "--skip=sources::socket::test::tcp_with_tls_intermediate_ca" 93 "--skip=sources::host_metrics::cgroups::tests::generates_cgroups_metrics" 94 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events" 95 "--skip=sources::aws_kinesis_firehose::tests::aws_kinesis_firehose_forwards_events_gzip_request" 96 "--skip=sources::aws_kinesis_firehose::tests::handles_acknowledgement_failure" 97 ]; 98 99 # recent overhauls of DNS support in 0.9 mean that we try to resolve 100 # vector.dev during the checkPhase, which obviously isn't going to work. 101 # these tests in the DNS module are trivial though, so stubbing them out is 102 # fine IMO. 103 # 104 # the geoip transform yields maxmindb.so which contains references to rustc. 105 # neither figured out why the shared object is included in the output 106 # (it doesn't seem to be a runtime dependencies of the geoip transform), 107 # nor do I know why it depends on rustc. 108 # However, in order for the closure size to stay at a reasonable level, 109 # transforms-geoip is patched out of Cargo.toml for now - unless explicitly asked for. 110 postPatch = '' 111 substituteInPlace ./src/dns.rs \ 112 --replace-fail "#[tokio::test]" "" 113 ''; 114 115 passthru = { 116 tests = { 117 inherit (nixosTests) vector; 118 }; 119 updateScript = nix-update-script { }; 120 }; 121 122 meta = with lib; { 123 description = "High-performance observability data pipeline"; 124 homepage = "https://github.com/vectordotdev/vector"; 125 changelog = "https://github.com/vectordotdev/vector/releases/tag/v${finalAttrs.version}"; 126 license = licenses.mpl20; 127 maintainers = with maintainers; [ 128 thoughtpolice 129 happysalada 130 ]; 131 platforms = with platforms; all; 132 mainProgram = "vector"; 133 }; 134})