2021-03-12 02:47:27 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, rustPlatform, openssl, pkg-config, protobuf
|
|
|
|
, Security, libiconv, rdkafka, tzdata, coreutils, CoreServices
|
2019-10-28 05:35:02 +00:00
|
|
|
|
|
|
|
, features ?
|
2021-03-12 02:47:27 +00:00
|
|
|
([ "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]
|
|
|
|
++ (lib.optional stdenv.targetPlatform.isUnix "unix")
|
|
|
|
++ [ "sinks" "sources" "transforms" ])
|
2019-10-28 05:35:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "vector";
|
2021-03-13 17:09:10 +00:00
|
|
|
version = "0.12.1";
|
2019-12-15 02:26:48 +00:00
|
|
|
|
2019-10-28 05:35:02 +00:00
|
|
|
src = fetchFromGitHub {
|
2019-12-15 02:26:48 +00:00
|
|
|
owner = "timberio";
|
|
|
|
repo = pname;
|
2020-02-16 00:47:46 +00:00
|
|
|
rev = "v${version}";
|
2021-03-13 17:09:10 +00:00
|
|
|
sha256 = "0sw05472znxmggckxjbrl3b8ky8nsw42xmrsb41p8z4q0aw115fd";
|
2019-10-28 05:35:02 +00:00
|
|
|
};
|
|
|
|
|
2021-03-13 17:09:10 +00:00
|
|
|
cargoSha256 = "0mfhrdqry6qrzfx5px1zqgfv5iqa186vl2yh290ibinkxy0x5fa9";
|
2020-03-29 09:18:27 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
buildInputs = [ openssl protobuf rdkafka ]
|
2021-01-15 09:19:50 +00:00
|
|
|
++ lib.optional stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
|
2019-10-28 05:35:02 +00:00
|
|
|
|
|
|
|
# needed for internal protobuf c wrapper library
|
|
|
|
PROTOC="${protobuf}/bin/protoc";
|
|
|
|
PROTOC_INCLUDE="${protobuf}/include";
|
|
|
|
|
2021-03-12 02:47:27 +00:00
|
|
|
cargoBuildFlags = [ "--no-default-features" "--features" (lib.concatStringsSep "," features) ];
|
2020-09-14 03:37:21 +01: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 13:09:39 +01: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-03-12 02:47:27 +00:00
|
|
|
postPatch = ''
|
2020-09-14 03:37:21 +01:00
|
|
|
substituteInPlace ./src/dns.rs \
|
2021-03-12 02:47:27 +00:00
|
|
|
--replace "#[tokio::test]" ""
|
2020-10-23 13:09:39 +01:00
|
|
|
|
|
|
|
${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
|
|
|
|
substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
|
|
|
|
''}
|
2020-09-14 03:37:21 +01:00
|
|
|
'';
|
2019-10-28 05:35:02 +00:00
|
|
|
|
2021-03-12 02:47:27 +00:00
|
|
|
passthru = { inherit features; };
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-10-28 05:35:02 +00:00
|
|
|
description = "A high-performance logs, metrics, and events router";
|
|
|
|
homepage = "https://github.com/timberio/vector";
|
|
|
|
license = with licenses; [ asl20 ];
|
2020-11-30 07:34:53 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice happysalada ];
|
2019-10-28 05:35:02 +00:00
|
|
|
};
|
|
|
|
}
|