nixpkgs/pkgs/tools/misc/vector/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

135 lines
4.6 KiB
Nix
Raw Normal View History

2021-04-01 12:22:51 +02:00
{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
, pkg-config
2021-06-11 13:18:56 +02:00
, openssl
2021-04-01 12:22:51 +02:00
, protobuf
2021-06-11 13:18:56 +02:00
, rdkafka
, oniguruma
, zstd
, rust-jemalloc-sys
2024-01-10 13:31:03 +01:00
, rust-jemalloc-sys-unprefixed
2021-04-01 12:22:51 +02:00
, Security
, libiconv
, coreutils
, CoreServices
, SystemConfiguration
2021-06-11 13:18:56 +02:00
, tzdata
2021-12-30 13:51:28 +01:00
, cmake
2022-04-08 13:52:45 +02:00
, perl
2023-04-24 01:53:51 +02:00
, git
2022-09-02 11:41:44 +02:00
# nix has a problem with the `?` in the feature list
# enabling kafka will produce a vector with no features at all
, enableKafka ? false
# TODO investigate adding various "vendor-*"
2021-06-11 13:18:56 +02:00
# "disk-buffer" is using leveldb TODO: investigate how useful
# it would be, perhaps only for massive scale?
, features ? ([ "api" "api-client" "enrichment-tables" "sinks" "sources" "sources-dnstap" "transforms" "component-validation-runner" ]
2021-06-11 13:18:56 +02: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-09-02 11:41:44 +02:00
++ lib.optionals enableKafka [ "rdkafka?/gssapi-vendored" ]
++ lib.optional stdenv.hostPlatform.isUnix "unix")
, nixosTests
2023-01-19 23:41:40 +01:00
, nix-update-script
}:
2021-10-24 03:12:05 +02:00
let
pname = "vector";
2024-01-10 13:31:03 +01:00
version = "0.35.0";
2021-10-24 03:12:05 +02:00
in
rustPlatform.buildRustPackage {
inherit pname version;
src = fetchFromGitHub {
owner = "vectordotdev";
2021-04-01 12:22:51 +02:00
repo = pname;
rev = "v${version}";
2024-01-10 13:31:03 +01:00
hash = "sha256-hScmHDkKkR6g1rrVRzBjtkrq59w1efIjeRJdDxmb+nY=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"aws-config-0.54.1" = "sha256-AVumLhybVbMnEah9/JqiQOQ4R0e2OsbB8WAJ422R6uk=";
2023-09-27 18:38:16 +02:00
"greptime-proto-0.1.0" = "sha256-kSOy/0s8ZJ1RfqOb469oaVlreABtHxesNaMzFH6H+aE=";
"greptimedb-client-0.1.0" = "sha256-mGgbxp/h55snowS2BV+QRwrhnE5vywfRF9Gc+8MoAdY=";
"heim-0.1.0-rc.1" = "sha256-ODKEQ1udt7FlxI5fvoFMG7C2zmM45eeEYDUEaLTsdYo=";
2023-04-24 01:53:51 +02:00
"nix-0.26.2" = "sha256-uquYvRT56lhupkrESpxwKEimRFhmYvri10n3dj0f2yg=";
"ntapi-0.3.7" = "sha256-G6ZCsa3GWiI/FeGKiK9TWkmTxen7nwpXvm5FtjNtjWU=";
2023-09-27 18:38:16 +02:00
"tokio-util-0.7.8" = "sha256-HCvtfohOoa1ZjD4s7QLDbIV4fe/MVBKtgM1QQX7gGKQ=";
"tracing-0.2.0" = "sha256-YAxeEofFA43PX2hafh3RY+C81a2v6n1fGzYz2FycC3M=";
};
};
2023-05-27 21:59:01 +02:00
nativeBuildInputs = [ pkg-config cmake perl git rustPlatform.bindgenHook ];
buildInputs =
2024-01-10 13:31:03 +01:00
[ oniguruma openssl protobuf rdkafka zstd ]
++ lib.optionals stdenv.isLinux [ rust-jemalloc-sys-unprefixed ]
++ lib.optionals stdenv.isDarwin [ rust-jemalloc-sys Security libiconv coreutils CoreServices SystemConfiguration ];
# needed for internal protobuf c wrapper library
2021-04-01 12:22:51 +02:00
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
2021-06-11 13:18:56 +02:00
RUSTONIG_SYSTEM_LIBONIG = true;
2021-11-16 01:19:01 +01:00
TZDIR = "${tzdata}/share/zoneinfo";
2022-04-16 12:38:53 +02:00
# needed to dynamically link rdkafka
CARGO_FEATURE_DYNAMIC_LINKING=1;
2021-11-16 01:19:01 +01:00
buildNoDefaultFeatures = true;
buildFeatures = features;
2021-06-11 13:18:56 +02:00
# TODO investigate compilation failure for tests
2022-06-03 05:52:37 +02:00
# there are about 100 tests failing (out of 1100) for version 0.22.0
2022-04-23 18:00:18 +02:00
doCheck = false;
2021-11-16 01:19:01 +01: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-26 13:53:10 +01: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-11-16 01:19:01 +01:00
];
2024-01-15 09:50:14 +01:00
patches = [ ./vector-pr19518.patch ];
# 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.
#
# 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.
postPatch = ''
substituteInPlace ./src/dns.rs \
--replace "#[tokio::test]" ""
'';
passthru = {
inherit features;
tests = { inherit (nixosTests) vector; };
2023-01-19 23:41:40 +01:00
updateScript = nix-update-script { };
};
meta = with lib; {
2023-04-02 08:22:32 +02:00
description = "A high-performance observability data pipeline";
homepage = "https://github.com/vectordotdev/vector";
license = licenses.mpl20;
2020-11-30 08:34:53 +01:00
maintainers = with maintainers; [ thoughtpolice happysalada ];
2022-10-05 22:48:28 +02:00
platforms = with platforms; all;
mainProgram = "vector";
};
}