diff options
Diffstat (limited to 'pkgs/tools/misc/vector/default.nix')
-rw-r--r-- | pkgs/tools/misc/vector/default.nix | 93 |
1 files changed, 69 insertions, 24 deletions
diff --git a/pkgs/tools/misc/vector/default.nix b/pkgs/tools/misc/vector/default.nix index ddbd78c699c..d9e454d4ab8 100644 --- a/pkgs/tools/misc/vector/default.nix +++ b/pkgs/tools/misc/vector/default.nix @@ -1,41 +1,86 @@ -{ stdenv, lib, fetchFromGitHub, rustPlatform -, openssl, pkg-config, protobuf -, Security, libiconv, rdkafka +{ stdenv +, lib +, fetchFromGitHub +, rustPlatform +, pkg-config +, llvmPackages +, openssl +, protobuf +, rdkafka +, oniguruma +, zstd +, Security +, libiconv +, coreutils +, CoreServices , tzdata - -, features ? - (if stdenv.isAarch64 - then [ "shiplift/unix-socket" "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ] - else [ "leveldb" "leveldb/leveldb-sys-2" "shiplift/unix-socket" "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]) + # 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) + ++ (lib.optionals enableKafka [ "rdkafka-plain" "rdkafka/dynamic_linking" ]) + ++ (lib.optional stdenv.targetPlatform.isUnix "unix")) }: rustPlatform.buildRustPackage rec { pname = "vector"; - version = "0.8.1"; + version = "0.15.0"; src = fetchFromGitHub { - owner = "timberio"; - repo = pname; - rev = "v${version}"; - sha256 = "0k15scvjcg2v4z80vq27yrn2wm50fp8xj8lga2czzs0zxhlv21nl"; + owner = "timberio"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-8ZsZyV6zlMiNTVYPwqQi7F1OJ4hV33IqrrGkvUb8JaY="; }; - cargoSha256 = "1al8jzjxjhxwb5n1d52pvl59d11g0bdg2dcw8ir2nclya1w68f2w"; + cargoSha256 = "sha256-t6KeyBwIfCQTfaennFiFX3K+8unFOsduBP7nRbAo9wI="; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ openssl protobuf rdkafka ] - ++ stdenv.lib.optional stdenv.isDarwin [ Security libiconv ]; + buildInputs = [ oniguruma openssl protobuf rdkafka zstd ] + ++ lib.optional stdenv.isDarwin [ Security libiconv coreutils CoreServices ]; # needed for internal protobuf c wrapper library - PROTOC="${protobuf}/bin/protoc"; - PROTOC_INCLUDE="${protobuf}/include"; + PROTOC = "${protobuf}/bin/protoc"; + PROTOC_INCLUDE = "${protobuf}/include"; + RUSTONIG_SYSTEM_LIBONIG = true; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + + cargoBuildFlags = [ "--no-default-features" "--features" (lib.concatStringsSep "," features) ]; + # 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; + 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. + # + # 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",' "" + ''} + ''; - cargoBuildFlags = [ "--no-default-features" "--features" "${lib.concatStringsSep "," features}" ]; - checkPhase = "TZDIR=${tzdata}/share/zoneinfo cargo test --no-default-features --features ${lib.concatStringsSep "," features},disable-resolv-conf -- --test-threads 1"; + passthru = { inherit features; }; - meta = with stdenv.lib; { + meta = with lib; { description = "A high-performance logs, metrics, and events router"; - homepage = "https://github.com/timberio/vector"; - license = with licenses; [ asl20 ]; - maintainers = with maintainers; [ thoughtpolice ]; + homepage = "https://github.com/timberio/vector"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ thoughtpolice happysalada ]; }; } |