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

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

110 lines
3.7 KiB
Nix
Raw Normal View History

2021-04-01 10:22:51 +00:00
{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
, pkg-config
2021-06-11 11:18:56 +00:00
, llvmPackages
, openssl
2021-04-01 10:22:51 +00:00
, protobuf
2021-06-11 11:18:56 +00:00
, rdkafka
, oniguruma
, zstd
2021-04-01 10:22:51 +00:00
, Security
, libiconv
, coreutils
, CoreServices
2021-06-11 11:18:56 +00:00
, tzdata
2021-12-30 12:51:28 +00:00
, cmake
2022-04-08 11:52:45 +00:00
, perl
2021-06-11 11:18:56 +00:00
# kafka is optional but one of the most used features
, enableKafka ? true
# TODO investigate adding "api" "api-client" "vrl-cli" and various "vendor-*"
# "disk-buffer" is using leveldb TODO: investigate how useful
# it would be, perhaps only for massive scale?
, features ? ([ "sinks" "sources" "transforms" ]
# the second feature flag is passed to the rdkafka dependency
# building on linux fails without this feature flag (both x86_64 and AArch64)
2021-11-16 00:19:01 +00:00
++ lib.optionals enableKafka [ "rdkafka-plain" "rdkafka/dynamic_linking" ]
++ lib.optional stdenv.targetPlatform.isUnix "unix")
}:
2021-10-24 01:12:05 +00:00
let
pname = "vector";
2022-04-08 11:52:45 +00:00
version = "0.20.1";
2021-10-24 01:12:05 +00:00
in
rustPlatform.buildRustPackage {
inherit pname version;
src = fetchFromGitHub {
2021-04-01 10:22:51 +00:00
owner = "timberio";
repo = pname;
rev = "v${version}";
2022-04-08 11:52:45 +00:00
sha256 = "sha256-0xC6CpmSTRt7zj6RHqtjbMXWEiMUOdIymWVGI8Js+70=";
};
2022-04-08 11:52:45 +00:00
cargoSha256 = "sha256-NLMyE9+iYFWuMmL50TeLZVvlHkIDaSZYJwXK4ykGrb8=";
nativeBuildInputs = [ pkg-config cmake perl ];
2021-06-11 11:18:56 +00:00
buildInputs = [ oniguruma openssl protobuf rdkafka zstd ]
2021-08-07 10:07:36 +00:00
++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
# needed for internal protobuf c wrapper library
2021-04-01 10:22:51 +00:00
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
2021-06-11 11:18:56 +00:00
RUSTONIG_SYSTEM_LIBONIG = true;
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
2021-11-16 00:19:01 +00:00
TZDIR = "${tzdata}/share/zoneinfo";
buildNoDefaultFeatures = true;
buildFeatures = features;
2021-06-11 11:18:56 +00:00
# TODO investigate compilation failure for tests
# dev dependency includes httpmock which depends on iashc which depends on curl-sys with http2 feature enabled
# compilation fails because of a missing http2 include
doCheck = !stdenv.isDarwin;
2021-11-16 00:19: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-26 12:53:10 +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-11-16 00:19:01 +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.
#
# 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]" ""
${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
''}
'';
passthru = { inherit features; };
meta = with lib; {
description = "A high-performance logs, metrics, and events router";
2021-04-01 10:22:51 +00:00
homepage = "https://github.com/timberio/vector";
license = with licenses; [ asl20 ];
2020-11-30 07:34:53 +00:00
maintainers = with maintainers; [ thoughtpolice happysalada ];
};
}