2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
rustPlatform,
|
|
|
|
pkg-config,
|
|
|
|
openssl,
|
|
|
|
protobuf,
|
|
|
|
rdkafka,
|
|
|
|
oniguruma,
|
|
|
|
zstd,
|
|
|
|
rust-jemalloc-sys,
|
|
|
|
rust-jemalloc-sys-unprefixed,
|
|
|
|
Security,
|
|
|
|
libiconv,
|
|
|
|
coreutils,
|
|
|
|
CoreServices,
|
|
|
|
SystemConfiguration,
|
|
|
|
tzdata,
|
|
|
|
cmake,
|
|
|
|
perl,
|
|
|
|
git,
|
2022-09-09 14:08:57 +00:00
|
|
|
# nix has a problem with the `?` in the feature list
|
|
|
|
# enabling kafka will produce a vector with no features at all
|
2024-09-19 14:19:46 +00:00
|
|
|
enableKafka ? false,
|
2023-07-15 17:15:38 +00:00
|
|
|
# TODO investigate adding various "vendor-*"
|
2021-06-28 23:13:55 +00:00
|
|
|
# "disk-buffer" is using leveldb TODO: investigate how useful
|
|
|
|
# it would be, perhaps only for massive scale?
|
2024-09-19 14:19:46 +00:00
|
|
|
features ? (
|
|
|
|
[
|
|
|
|
"api"
|
|
|
|
"api-client"
|
|
|
|
"enrichment-tables"
|
|
|
|
"sinks"
|
|
|
|
"sources"
|
|
|
|
"sources-dnstap"
|
|
|
|
"transforms"
|
|
|
|
"component-validation-runner"
|
|
|
|
]
|
2021-06-28 23:13:55 +00: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-09 14:08:57 +00:00
|
|
|
++ lib.optionals enableKafka [ "rdkafka?/gssapi-vendored" ]
|
2024-09-19 14:19:46 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isUnix "unix"
|
|
|
|
),
|
|
|
|
nixosTests,
|
|
|
|
nix-update-script,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "vector";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.41.1";
|
2021-10-28 06:52:43 +00:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
inherit pname version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-06-26 10:26:21 +00:00
|
|
|
owner = "vectordotdev";
|
2021-04-05 15:23:46 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-E6AVjxwXMDonqsAMcCpaZBEPCi9bVXUygG4PUOLh+ck=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2024-09-19 14:19:46 +00:00
|
|
|
"greptime-proto-0.1.0" = "sha256-QT3PZnHJoVghuRCGoZIH6L8jnX7Wn9eSuQqHIyrUY4E=";
|
|
|
|
"greptimedb-ingester-0.1.0" = "sha256-1M9yWXDZ6U9JTVyXQg9ZcSSGJp7GXtaCfQHdtjhw6FY=";
|
|
|
|
"heim-0.1.0-rc.1" = "sha256-pMraYKr6srTQqEzoBx9gGHHlJ7nMKwj50ftimQAkfL0=";
|
2023-04-29 16:46:19 +00:00
|
|
|
"nix-0.26.2" = "sha256-uquYvRT56lhupkrESpxwKEimRFhmYvri10n3dj0f2yg=";
|
2023-07-15 17:15:38 +00:00
|
|
|
"ntapi-0.3.7" = "sha256-G6ZCsa3GWiI/FeGKiK9TWkmTxen7nwpXvm5FtjNtjWU=";
|
2024-09-19 14:19:46 +00:00
|
|
|
"tokio-util-0.7.11" = "sha256-oV9fSPjLMY1KbcbDP2WTVjF/N0qlQBPDIYHOp3aNCTY=";
|
2023-03-27 19:17:25 +00:00
|
|
|
"tracing-0.2.0" = "sha256-YAxeEofFA43PX2hafh3RY+C81a2v6n1fGzYz2FycC3M=";
|
|
|
|
};
|
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
cmake
|
|
|
|
perl
|
|
|
|
git
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
];
|
2024-01-02 11:29:13 +00:00
|
|
|
buildInputs =
|
2024-09-19 14:19:46 +00:00
|
|
|
[
|
|
|
|
oniguruma
|
|
|
|
openssl
|
|
|
|
protobuf
|
|
|
|
rdkafka
|
|
|
|
zstd
|
|
|
|
]
|
2024-01-25 14:12:00 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ rust-jemalloc-sys-unprefixed ]
|
2024-09-19 14:19:46 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
rust-jemalloc-sys
|
|
|
|
Security
|
|
|
|
libiconv
|
|
|
|
coreutils
|
|
|
|
CoreServices
|
|
|
|
SystemConfiguration
|
|
|
|
];
|
|
|
|
|
|
|
|
# Rust 1.80.0 introduced the unexepcted_cfgs lint, which requires crates to allowlist custom cfg options that they inspect.
|
|
|
|
# Upstream is working on fixing this in https://github.com/vectordotdev/vector/pull/20949, but silencing the lint lets us build again until then.
|
|
|
|
# TODO remove when upgrading Vector
|
|
|
|
RUSTFLAGS = "--allow unexpected_cfgs";
|
|
|
|
|
|
|
|
# Without this, we get SIGSEGV failure
|
|
|
|
RUST_MIN_STACK = 33554432;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# needed for internal protobuf c wrapper library
|
2021-04-05 15:23:46 +00:00
|
|
|
PROTOC = "${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE = "${protobuf}/include";
|
2021-06-28 23:13:55 +00:00
|
|
|
RUSTONIG_SYSTEM_LIBONIG = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
TZDIR = "${tzdata}/share/zoneinfo";
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# needed to dynamically link rdkafka
|
2024-09-19 14:19:46 +00:00
|
|
|
CARGO_FEATURE_DYNAMIC_LINKING = 1;
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
CARGO_PROFILE_RELEASE_LTO = "fat";
|
|
|
|
CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1";
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
buildFeatures = features;
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# TODO investigate compilation failure for tests
|
2022-06-16 17:23:12 +00:00
|
|
|
# there are about 100 tests failing (out of 1100) for version 0.22.0
|
2022-04-27 09:35:20 +00:00
|
|
|
doCheck = false;
|
2021-12-06 16:07:01 +00: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-27 00:19:43 +00: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-12-06 16:07:01 +00:00
|
|
|
];
|
2020-10-11 12:50:04 +00:00
|
|
|
|
|
|
|
# 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.
|
2020-11-12 09:05:59 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2021-04-05 15:23:46 +00:00
|
|
|
postPatch = ''
|
2020-10-11 12:50:04 +00:00
|
|
|
substituteInPlace ./src/dns.rs \
|
2024-09-19 14:19:46 +00:00
|
|
|
--replace-fail "#[tokio::test]" ""
|
2020-10-11 12:50:04 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
passthru = {
|
|
|
|
inherit features;
|
2024-09-19 14:19:46 +00:00
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) vector;
|
|
|
|
};
|
2023-01-20 10:41:00 +00:00
|
|
|
updateScript = nix-update-script { };
|
2022-12-28 21:21:41 +00:00
|
|
|
};
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "High-performance observability data pipeline";
|
2023-04-12 12:48:02 +00:00
|
|
|
homepage = "https://github.com/vectordotdev/vector";
|
|
|
|
license = licenses.mpl20;
|
2024-09-19 14:19:46 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
thoughtpolice
|
|
|
|
happysalada
|
|
|
|
];
|
2022-10-06 18:32:54 +00:00
|
|
|
platforms = with platforms; all;
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "vector";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|