-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gRPC 1.46.3 (also fix builds on Darwin) #138
Open
unclechu
wants to merge
11
commits into
awakesecurity:master
Choose a base branch
from
unclechu:use-grpc-1.46.3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+529
−283
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ffdd8f9
Update Nix setup to work with latest release-22.05 nixpkgs pin
unclechu d970b47
Fix C API to make it work with gRPC 1.46.3
unclechu 93fed04
Update Stack build to work with newer versions of dependencies
unclechu aece98a
Add stack.yaml.lock file
unclechu fac34c9
Fetch patch for data-diverse from GitHub repo
unclechu 8895c38
Refactor Nix configuration: Expose overridden Haskell dependencies
unclechu add6320
Pin versions of gRPC dependencies
unclechu 926a9d9
Pin overridden Haskell dependencies
unclechu 2cf0feb
Add missing `pipes` and `tasty-hunit` for the nix-shell
unclechu c0c4b2f
Update gRPC version mentioned in the README
unclechu 5df3fdd
Refactor use of Haskell Nix lib functions
unclechu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ mkDerivation, base, containers, criterion, deepseq, ghc-prim | ||
, hspec, lib, tagged | ||
}: | ||
mkDerivation { | ||
pname = "data-diverse"; | ||
version = "4.7.0.0"; | ||
sha256 = "sha256-w82WWNWbShoYYtDFvJHgQUb1vxEehGmgUOpq4SZaizE="; | ||
libraryHaskellDepends = [ | ||
base containers deepseq ghc-prim tagged | ||
]; | ||
testHaskellDepends = [ base hspec tagged ]; | ||
benchmarkHaskellDepends = [ base criterion ]; | ||
homepage = "https://github.com/louispan/data-diverse#readme"; | ||
description = "Extensible records and polymorphic variants"; | ||
license = lib.licenses.bsd3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Copy-paste from nixpkgs “release-22.05” branch | ||
|
||
{ lib | ||
, stdenv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, buildPackages | ||
, cmake | ||
, zlib | ||
, c-ares | ||
, pkg-config | ||
, re2 | ||
, openssl | ||
, protobuf | ||
, grpc | ||
, abseil-cpp | ||
, libnsl | ||
|
||
# tests | ||
, python3 | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "grpc"; | ||
version = "1.46.3"; # N.B: if you change this, please update: | ||
# pythonPackages.grpcio-tools | ||
# pythonPackages.grpcio-status | ||
|
||
src = fetchFromGitHub { | ||
owner = "grpc"; | ||
repo = "grpc"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-RiXtKlRtlbqwrSxI904dgSu3da0A6Fwk+/hWHIG7A5E="; | ||
fetchSubmodules = true; | ||
}; | ||
|
||
patches = [ | ||
# Fix build on armv6l (https://github.com/grpc/grpc/pull/21341) | ||
(fetchpatch { | ||
url = "https://github.com/grpc/grpc/commit/2f4cf1d9265c8e10fb834f0794d0e4f3ec5ae10e.patch"; | ||
sha256 = "0ams3jmgh9yzwmxcg4ifb34znamr7pb4qm0609kvil9xqvkqz963"; | ||
}) | ||
|
||
# Revert gRPC C++ Mutex to be an alias of Abseil, because it breaks dependent packages | ||
(fetchpatch { | ||
url = "https://github.com/grpc/grpc/commit/931f91b745cd5b2864a0d1787815871d0bd844ae.patch"; | ||
sha256 = "0vc93g2i4982ys4gzyaxdv9ni25yk10sxq3n7fkz8dypy8sylck7"; | ||
revert = true; | ||
}) | ||
]; | ||
|
||
nativeBuildInputs = [ cmake pkg-config ] | ||
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) grpc; | ||
propagatedBuildInputs = [ c-ares re2 zlib abseil-cpp ]; | ||
buildInputs = [ c-ares.cmake-config openssl protobuf ] | ||
++ lib.optionals stdenv.isLinux [ libnsl ]; | ||
|
||
cmakeFlags = [ | ||
"-DgRPC_ZLIB_PROVIDER=package" | ||
"-DgRPC_CARES_PROVIDER=package" | ||
"-DgRPC_RE2_PROVIDER=package" | ||
"-DgRPC_SSL_PROVIDER=package" | ||
"-DgRPC_PROTOBUF_PROVIDER=package" | ||
"-DgRPC_ABSL_PROVIDER=package" | ||
"-DBUILD_SHARED_LIBS=ON" | ||
"-DCMAKE_SKIP_BUILD_RPATH=OFF" | ||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ | ||
"-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc" | ||
] ++ lib.optionals ((stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "11.0") [ | ||
# Needs to be compiled with -std=c++11 for clang < 11. Interestingly this is | ||
# only an issue with the useLLVM stdenv, not the darwin stdenv… | ||
# https://github.com/grpc/grpc/issues/26473#issuecomment-860885484 | ||
"-DCMAKE_CXX_STANDARD=11" | ||
]; | ||
|
||
# CMake creates a build directory by default, this conflicts with the | ||
# basel BUILD file on case-insensitive filesystems. | ||
preConfigure = '' | ||
rm -vf BUILD | ||
''; | ||
|
||
# When natively compiling, grpc_cpp_plugin is executed from the build directory, | ||
# needing to load dynamic libraries from the build directory, so we set | ||
# LD_LIBRARY_PATH to enable this. When cross compiling we need to avoid this, | ||
# since it can cause the grpc_cpp_plugin executable from buildPackages to | ||
# crash if build and host architecture are compatible (e. g. pkgsLLVM). | ||
preBuild = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' | ||
export LD_LIBRARY_PATH=$(pwd)''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH | ||
''; | ||
|
||
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=unknown-warning-option" | ||
+ lib.optionalString stdenv.isAarch64 "-Wno-error=format-security"; | ||
|
||
enableParallelBuilds = true; | ||
|
||
passthru.tests = { | ||
inherit (python3.pkgs) grpcio-status grpcio-tools; | ||
}; | ||
|
||
meta = with lib; { | ||
description = "The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ lnl7 marsam ]; | ||
homepage = "https://grpc.io/"; | ||
platforms = platforms.all; | ||
changelog = "https://github.com/grpc/grpc/releases/tag/v${version}"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copy-paste from nixpkgs “release-22.05” branch | ||
|
||
{ lib | ||
, buildPythonPackage | ||
, fetchPypi | ||
, googleapis-common-protos | ||
, grpcio | ||
, protobuf | ||
, pythonOlder | ||
}: | ||
|
||
buildPythonPackage rec { | ||
pname = "grpcio-status"; | ||
version = "1.46.3"; | ||
format = "setuptools"; | ||
|
||
disabled = pythonOlder "3.6"; | ||
|
||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = "78442ac7d2813c56f9cc04f713efd7088596b10f88a4ddd09279211cc48402d5"; | ||
}; | ||
|
||
propagatedBuildInputs = [ | ||
googleapis-common-protos | ||
grpcio | ||
protobuf | ||
]; | ||
|
||
# Projec thas no tests | ||
doCheck = false; | ||
|
||
pythonImportsCheck = [ | ||
"grpc_status" | ||
]; | ||
|
||
meta = with lib; { | ||
description = "GRPC Python status proto mapping"; | ||
homepage = "https://github.com/grpc/grpc/tree/master/src/python/grpcio_status"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ fab ]; | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to pin
grpc.nix
ifnixpkgs.nix
now usesrelease-22.05
?Same question for the other
grpc
-related pinsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gabriella439 technically no but the library is often used with different nixpkgs pins, not one provided by gRPC-haskell. So gRPC version can be different, thus there can be breaking changes. This feels more reliable to provide fixed pin of gRPC version this library specifically is built for.