diff --git a/pkgs/development/libraries/protobuf/generic.nix b/pkgs/development/libraries/protobuf/generic.nix index 0165766f3fa4..11fa9ebff6c1 100644 --- a/pkgs/development/libraries/protobuf/generic.nix +++ b/pkgs/development/libraries/protobuf/generic.nix @@ -42,14 +42,23 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail 'tmpnam(b)' '"'$TMPDIR'/foo"' ''; - patches = lib.optionals (lib.versionOlder version "22") [ - # fix protobuf-targets.cmake installation paths, and allow for CMAKE_INSTALL_LIBDIR to be absolute - # https://github.com/protocolbuffers/protobuf/pull/10090 - (fetchpatch { - url = "https://github.com/protocolbuffers/protobuf/commit/a7324f88e92bc16b57f3683403b6c993bf68070b.patch"; - hash = "sha256-SmwaUjOjjZulg/wgNmR/F5b8rhYA2wkKAjHIOxjcQdQ="; - }) - ]; + patches = + lib.optionals (lib.versionOlder version "22") [ + # fix protobuf-targets.cmake installation paths, and allow for CMAKE_INSTALL_LIBDIR to be absolute + # https://github.com/protocolbuffers/protobuf/pull/10090 + (fetchpatch { + url = "https://github.com/protocolbuffers/protobuf/commit/a7324f88e92bc16b57f3683403b6c993bf68070b.patch"; + hash = "sha256-SmwaUjOjjZulg/wgNmR/F5b8rhYA2wkKAjHIOxjcQdQ="; + }) + ] + ++ lib.optionals (lib.versions.major version == "29") [ + # fix temporary directory handling to avoid test failures on darwin + # https://github.com/NixOS/nixpkgs/issues/464439 + (fetchpatch { + url = "https://github.com/protocolbuffers/protobuf/commit/0e9d0f6e77280b7a597ebe8361156d6bb1971dca.patch"; + hash = "sha256-rIP+Ft/SWVwh9Oy8y8GSUBgP6CtLCLvGmr6nOqmyHhY="; + }) + ]; # hook to provide the path to protoc executable, used at build time build_protobuf = @@ -100,6 +109,10 @@ stdenv.mkDerivation (finalAttrs: { versionCheckProgramArg = "--version"; doInstallCheck = true; + env = lib.optionalAttrs (lib.versions.major version == "29") { + GTEST_DEATH_TEST_STYLE = "threadsafe"; + }; + passthru = { tests = { pythonProtobuf = python3.pkgs.protobuf;