-
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
base: master
Are you sure you want to change the base?
Conversation
This is a partial step to support gRPC 1.46.3 (from that nixpkgs pin).
My merge request was merged so the patch is already in the repo.
So that applied patches always work
So that now the tests can be ran successfully by: ``` cabal configure --enable-tests && cabal build && cabal test ```
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.
I'm guessing that the reason for the unexpected failure is that the error code changed with the gRPC upgrade and you might have to add another case to the branch
@@ -0,0 +1,108 @@ | |||
# Copy-paste from nixpkgs “release-22.05” branch |
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
if nixpkgs.nix
now uses release-22.05
?
Same question for the other grpc
-related pins
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.
@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.
inherit (pkgs) test-grpc-haskell; | ||
|
||
inherit hsPkgsOverridden; # Function :: nixpkgs -> new haskellPackages | ||
inherit (hsPkgsOverridden (nixpkgs {})) data-diverse proto3-wire proto3-suite; |
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 need to re-export data-diverse
/ proto3-wire
/ proto3-suite
?
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.
@Gabriella439 if someone is using the library without using the overlay
it can be really useful to reach those already patched dependencies (all these 3 require patching). When they are exported they are just ready to use.
Is there anything I can help to move this forward? @Gabriella439 @unclechu |
@fumieval what would be helpful is if you could provide a review of this PR yourself, someone from our org will also have to (it will likely be me I think) but I'll have to swap in a lot so it would certainly help move things along if you provided a review... |
- Upgraded the pinned nixpkgs to nixos-21.11 which contains grpc-1.42.0. This requires no code changes to `grpc-haskell` and `grpc-haskell-core` libraries. - Picked up latest commits of `proto3-{wire,suite}` and adjusted transitive dependencies - Switched to python 3 because `grpcio-tools` requires it. Adjusted test scripts accordingly. - Upgraded to latest CI action versions. This change is minimal compared to #138 and will solve some test failures in that PR. Hopefully, this will make it easier to move that PR forward.
Closes #136.
Some context
I had to fix issues with building
nixpkgs.grpc
on Darwin usingrelease-22.05
nixpkgs branch. The pin from gRPC-haskell (1.34.1
) was giving some “undefined reference” errors coming fromnixpkgs.abseil-cpp
library as it seems. It turned out thatnixpkgs.grpc
fromrelease-22.05
branch (1.46.3
) builds just fine on Darwin but it’s not compatible with gRPC-haskell, there are some breaking changes in gRPC API. I decided it would be easier to just implement support for gRPC-haskell for1.46.3
gRPC version than debugging the old1.34.1
against Darwin, especially taking into account that I don’t have any Apple hardware by hand.What I changed
The change to the API that makes it work with gRPC
1.46.3
is relatively small. There are few differences in the newer version of gRPC how the insecure/unauthenticated server and channel are created. This are no*_insecure_*
functions anymore. Instead there are functions that are creating insecure credentials object.Though I significantly refactored Nix configuration for the project:
nixpkgs
pin to use therelease-22.05
branchshell
attribute todefault.nix
that I used to make this change, originalshell.nix
was failing to build for me when I was making a fix. After the fix it started to build fine, but while API was broken is was impossible to enter a nix-shell. So this addition based onhaskellPackages.shellFor
can be useful comparing toshell.nix
which is justgrpc-haskell.env
.stack-env
attribute todefault.nix
that makes Stack project buildable on NixOS (gmp
andzlib
are required). I used this command to build the projectstack build --nix --system-ghc --no-test
nixpkgs
pins where the versions of those dependencies may changeproto3-wire
andproto3-suite
to match the versions fromrelease-22.05
branch ofnixpkgs
default.nix
overridden Haskell dependenciesnixpkgs.python3
instead ofnixpkgs.python
which is Python 2 by default because some of the Python dependencies of gRPC do not support Python 2 anymore and entering nix-shell fails due to thisNote that I also updated the Stack configuration to use the newer snapshot to match the GHC version from nixpkgs pin. I also added
stack.yaml.lock
file to the project.Open questions for the maintainer(s)
About tests
grpc-haskell-core
about graceful shutdowns (seeLowLevelTests.testGoaway
/core/tests/LowLevelTests.hs
). But what’s weird that it’s not always failing. I managed to build it on one of my machines when it was successful. Do you have any ideas how to fix it or what could be the problem? It doesn’t seem like it’s related to my changes but rather to the newer version of gRPC for instance.nix-build -A grpc-haskell
withoutno-tests
fails with:Builder called die: Cannot wrap 'tests/protoc.sh' because it is not an executable file
. Is that a known issue?cabal configure --enable-tests && cabal test
in a Nix Shell using new Cabal 3.x for instance? This command doesn’t work.pipes
andtasty-hunit
packages to theghcWithPackages
ofgrpc-haskell
and it worked. Kind of. It runs the tests infinitely (never finishes):Support of different gRPC versions
CPP
extension and add some conditions for the code. But the problem is that gRPC is not a Haskell package, there is no way to easily check the version of that C-library dependency version right? Maybe some Template Haskell magic can do that? Or maybe let’s provide gRPC version as Cabal flag? And default it to the supported1.46.3
and in Nix there can be automatic set of this flag to thenixpkgs.grpc.version
. What do you think about this?