vector: add sinks, sources and transforms as nixpkgs default features

Don't include transform-geoip unless this feature is explicitly selected
This commit is contained in:
Johan Thomsen 2020-10-23 14:09:39 +02:00
parent b36db49ae7
commit a03c8a8f35
1 changed files with 14 additions and 1 deletions

View File

@ -4,9 +4,11 @@
, tzdata , tzdata
, features ? , features ?
(if stdenv.isAarch64 ((if stdenv.isAarch64
then [ "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ] then [ "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]
else [ "leveldb" "leveldb/leveldb-sys-2" "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]) else [ "leveldb" "leveldb/leveldb-sys-2" "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ])
++
[ "sinks" "sources" "transforms" ])
, coreutils , coreutils
, CoreServices , CoreServices
}: }:
@ -38,9 +40,20 @@ rustPlatform.buildRustPackage rec {
# vector.dev during the checkPhase, which obviously isn't going to work. # 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 # these tests in the DNS module are trivial though, so stubbing them out is
# fine IMO. # 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.
patchPhase = '' patchPhase = ''
substituteInPlace ./src/dns.rs \ substituteInPlace ./src/dns.rs \
--replace "#[test]" "" --replace "#[test]" ""
${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
''}
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {