2019-10-28 06:35:02 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, rustPlatform
|
2020-02-16 01:47:46 +01:00
|
|
|
, openssl, pkg-config, protobuf
|
2019-12-17 11:40:51 +01:00
|
|
|
, Security, libiconv, rdkafka
|
2020-02-25 18:39:50 +01:00
|
|
|
, tzdata
|
2019-10-28 06:35:02 +01:00
|
|
|
|
|
|
|
, features ?
|
2020-10-23 14:09:39 +02:00
|
|
|
((if stdenv.isAarch64
|
2020-09-14 04:37:21 +02:00
|
|
|
then [ "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]
|
|
|
|
else [ "leveldb" "leveldb/leveldb-sys-2" "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ])
|
2020-10-23 14:09:39 +02:00
|
|
|
++
|
|
|
|
[ "sinks" "sources" "transforms" ])
|
2020-09-14 04:37:21 +02:00
|
|
|
, coreutils
|
|
|
|
, CoreServices
|
2019-10-28 06:35:02 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "vector";
|
2020-09-14 04:37:21 +02:00
|
|
|
version = "0.10.0";
|
2019-12-15 03:26:48 +01:00
|
|
|
|
2019-10-28 06:35:02 +01:00
|
|
|
src = fetchFromGitHub {
|
2019-12-15 03:26:48 +01:00
|
|
|
owner = "timberio";
|
|
|
|
repo = pname;
|
2020-02-16 01:47:46 +01:00
|
|
|
rev = "v${version}";
|
2020-09-14 04:37:21 +02:00
|
|
|
sha256 = "0q6x3fvwwh18iyznqlr09n3zppzgw9jaz973s8haz54hnxj16wx0";
|
2019-10-28 06:35:02 +01:00
|
|
|
};
|
|
|
|
|
2020-09-14 04:37:21 +02:00
|
|
|
cargoSha256 = "Y/vDYXWQ65zZ86vTwP4aCZYCMZuqbz6tpfv4uRkFAzc=";
|
2020-03-29 10:18:27 +02:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
buildInputs = [ openssl protobuf rdkafka ]
|
2020-09-14 04:37:21 +02:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
|
2019-10-28 06:35:02 +01:00
|
|
|
|
|
|
|
# needed for internal protobuf c wrapper library
|
|
|
|
PROTOC="${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE="${protobuf}/include";
|
|
|
|
|
|
|
|
cargoBuildFlags = [ "--no-default-features" "--features" "${lib.concatStringsSep "," features}" ];
|
2020-09-14 04:37:21 +02:00
|
|
|
checkPhase = "TZDIR=${tzdata}/share/zoneinfo cargo test --no-default-features --features ${lib.concatStringsSep "," features} -- --test-threads 1";
|
|
|
|
|
|
|
|
# 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-10-23 14:09:39 +02: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.
|
2020-09-14 04:37:21 +02:00
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace ./src/dns.rs \
|
|
|
|
--replace "#[test]" ""
|
2020-10-23 14:09:39 +02:00
|
|
|
|
|
|
|
${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
|
|
|
|
substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
|
|
|
|
''}
|
2020-09-14 04:37:21 +02:00
|
|
|
'';
|
2019-10-28 06:35:02 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A high-performance logs, metrics, and events router";
|
|
|
|
homepage = "https://github.com/timberio/vector";
|
|
|
|
license = with licenses; [ asl20 ];
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
|
|
};
|
|
|
|
}
|