anchor.diff:    PROTOC="${protobuf}/bin/protoc";
     PROTOC_INCLUDE="${protobuf}/include";
   
  -  cargoBuildFlags = [ "--no-default-features" "--features" "${lib.concatStringsSep "," features}" ];
  +  cargoBuildFlags = [ "--no-default-features" "--features" (lib.concatStringsSep "," features) ];
     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
  
positive.code:   # 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 = ''
      substituteInPlace ./src/dns.rs \
        --replace "#[test]" ""
  
      ${lib.optionalString (!builtins.elem "transforms-geoip" features) ''
          substituteInPlace ./Cargo.toml --replace '"transforms-geoip",' ""
      ''}
    '';
  
    meta = with lib; {
      description = "A high-performance logs, metrics, and events router";
  
negative.code: { stdenv, lib, fetchFromGitHub, rustPlatform, openssl, pkg-config, protobuf
  , Security, libiconv, rdkafka, tzdata, coreutils, CoreServices
  
  , features ?
         ([ "jemallocator" "rdkafka" "rdkafka/dynamic_linking" ]
      ++ (lib.optional stdenv.targetPlatform.isUnix "unix")
      ++ [ "sinks" "sources" "transforms" ])
  }:
  
  rustPlatform.buildRustPackage rec {
    pname = "vector";
    version = "0.12.0";
  
    src = fetchFromGitHub {
      owner  = "timberio";
      repo   = pname;
      rev    = "v${version}";
      sha256 = "02qbn9w9286ran8vjry9090r9ym9bj9xxvyzavw7gk53sg56m8gl";
    };
  
    cargoSha256 = "0zynyc7vkdf5pzz4svymsn3w8r834hc5gqxm1jk6myidvnyh2xsp";
    nativeBuildInputs = [ pkg-config ];
    buildInputs = [ openssl protobuf rdkafka ]
                  ++ lib.optional stdenv.isDarwin [ Security libiconv coreutils CoreServices ];
  