diff --git a/core/grpc-haskell-core.cabal b/core/grpc-haskell-core.cabal index dabc5b4..71ce861 100644 --- a/core/grpc-haskell-core.cabal +++ b/core/grpc-haskell-core.cabal @@ -22,7 +22,7 @@ Flag Debug library build-depends: base >=4.8 && <5.0 - , clock >=0.6.0 && <0.8.0 + , clock >=0.6.0 && <0.9 , bytestring ==0.10.* , stm >=2.4 && <2.6 , containers >=0.5 && <0.7 @@ -94,7 +94,7 @@ test-suite tests , proto3-suite , transformers , safe - , clock >=0.6.0 && <0.8.0 + , clock >=0.6.0 && <0.9 , turtle >= 1.2.0 , text , QuickCheck >=2.8 && <3.0 diff --git a/grpc-haskell.cabal b/grpc-haskell.cabal index 4863c9f..36ca99c 100644 --- a/grpc-haskell.cabal +++ b/grpc-haskell.cabal @@ -204,7 +204,7 @@ test-suite tests , proto3-suite , transformers , safe - , clock >=0.6.0 && <0.8.0 + , clock >=0.6.0 && <0.9 , turtle >= 1.2.0 , text , QuickCheck >=2.10 && <3.0 diff --git a/nix/data-diverse.patch b/nix/data-diverse.patch new file mode 100644 index 0000000..c37cd7c --- /dev/null +++ b/nix/data-diverse.patch @@ -0,0 +1,13 @@ +diff --git a/test/Data/Diverse/ManySpec.hs b/test/Data/Diverse/ManySpec.hs +index eb7203f..9672af8 100644 +--- a/test/Data/Diverse/ManySpec.hs ++++ b/test/Data/Diverse/ManySpec.hs +@@ -305,7 +305,7 @@ spec = do + + it "with duplicate fields has setter for unique fields 'amend''" $ do + let x = (5 :: Int) ./ False ./ 'X' ./ Just 'O' ./ (6 :: Int) ./ Just 'A' ./ nil +- amend' @ '[Bool, Char] x (True ./ 'B' ./ nil) `shouldBe` ++ amend' @'[Bool, Char] x (True ./ 'B' ./ nil) `shouldBe` + (5 :: Int) ./ True ./ 'B' ./ Just 'O' ./ (6 :: Int) ./ Just 'A' ./ nil + + it "can be folded with 'Many' handlers using 'forMany' or 'collect'" $ do diff --git a/nix/grpc.nix b/nix/grpc.nix deleted file mode 100644 index 92cf619..0000000 --- a/nix/grpc.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, openssl, protobuf -, gflags, abseil-cpp, libnsl -}: - -stdenv.mkDerivation rec { - version = "1.34.1"; # N.B: if you change this, change pythonPackages.grpcio-tools to a matching version too - pname = "grpc"; - src = fetchFromGitHub { - owner = "grpc"; - repo = "grpc"; - rev = "v${version}"; - sha256 = "0p6si9i0gg885ag2x87a7jyzhgd5lhx2bh2vjj2ra1jn6y3vg6qk"; - 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"; - }) - ]; - - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ zlib c-ares c-ares.cmake-config openssl protobuf gflags abseil-cpp ] - ++ lib.optionals stdenv.isLinux [ libnsl ]; - - cmakeFlags = - [ "-DgRPC_ZLIB_PROVIDER=package" - "-DgRPC_CARES_PROVIDER=package" - "-DgRPC_SSL_PROVIDER=package" - "-DgRPC_PROTOBUF_PROVIDER=package" - "-DgRPC_GFLAGS_PROVIDER=package" - "-DgRPC_ABSL_PROVIDER=package" - "-DBUILD_SHARED_LIBS=ON" - "-DCMAKE_SKIP_BUILD_RPATH=OFF" - ]; - - # CMake creates a build directory by default, this conflicts with the - # basel BUILD file on case-insensitive filesystems. - preConfigure = '' - rm -vf BUILD - ''; - - preBuild = '' - export LD_LIBRARY_PATH=$(pwd)''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH - ''; - - NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=unknown-warning-option"; - - enableParallelBuilds = true; - - meta = with lib; { - description = "The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)"; - license = licenses.asl20; - maintainers = [ maintainers.lnl7 maintainers.marsam ]; - homepage = "https://grpc.io/"; - platforms = platforms.all; - changelog = "https://github.com/grpc/grpc/releases/tag/v${version}"; - }; -} diff --git a/nix/parameterized.patch b/nix/parameterized.patch deleted file mode 100644 index 08e03e8..0000000 --- a/nix/parameterized.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/test/Parameterized/Control/Monad/Trans/Reader/ReaderSpec.hs b/test/Parameterized/Control/Monad/Trans/Reader/ReaderSpec.hs -index a39d181..1999e57 100644 ---- a/test/Parameterized/Control/Monad/Trans/Reader/ReaderSpec.hs -+++ b/test/Parameterized/Control/Monad/Trans/Reader/ReaderSpec.hs -@@ -91,7 +91,7 @@ whichIntBoolStringReader = do - manyIntMaybeReader :: ReaderT (Many '[Int]) Maybe String - manyIntMaybeReader = do - a <- ask -- let r = fetch @Int a -+ let r = grab @Int a - case r of - 0 -> empty - r' -> pure $ show r' -@@ -99,7 +99,7 @@ manyIntMaybeReader = do - manyBoolMaybeReader :: ReaderT (Many '[Bool]) Maybe String - manyBoolMaybeReader = do - a <- ask -- let r = fetch @Bool a -+ let r = grab @Bool a - case r of - False -> empty - r' -> pure $ show r' -diff --git a/test/Parameterized/Control/Monad/Trans/State/Strict/StateSpec.hs b/test/Parameterized/Control/Monad/Trans/State/Strict/StateSpec.hs -index 7dfd46c..4777c13 100644 ---- a/test/Parameterized/Control/Monad/Trans/State/Strict/StateSpec.hs -+++ b/test/Parameterized/Control/Monad/Trans/State/Strict/StateSpec.hs -@@ -26,7 +26,7 @@ main = hspec spec - manyIntMaybeState :: StateT (Many '[Int]) Maybe String - manyIntMaybeState= do - s <- get -- let r = fetch @Int s -+ let r = grab @Int s - case r of - 0 -> empty - r' -> do -@@ -36,7 +36,7 @@ manyIntMaybeState= do - manyBoolMaybeState :: StateT (Many '[Bool]) Maybe String - manyBoolMaybeState = do - s <- get -- let r = fetch @Bool s -+ let r = grab @Bool s - case r of - False -> empty - r' -> do diff --git a/nix/proto3-suite.nix b/nix/proto3-suite.nix deleted file mode 100644 index ce96ae4..0000000 --- a/nix/proto3-suite.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ mkDerivation, aeson, aeson-pretty, attoparsec, base -, base64-bytestring, binary, bytestring, cereal, containers -, contravariant, deepseq, doctest, fetchgit, filepath, foldl -, generic-arbitrary, hashable, haskell-src -, insert-ordered-containers, lens, lib, mtl, neat-interpolation -, optparse-applicative, optparse-generic, parsec, parsers, pretty -, pretty-show, proto3-wire, QuickCheck, quickcheck-instances -, range-set-list, safe, swagger2, system-filepath, tasty -, tasty-hunit, tasty-quickcheck, text, time, transformers, turtle -, vector -}: -mkDerivation { - pname = "proto3-suite"; - version = "0.4.3"; - src = fetchgit { - url = "https://github.com/awakesecurity/proto3-suite.git"; - sha256 = "0bjqczi6wddxv0n7qmfbrr19ajgq66xdkxx8vfcgbmv8ygma3vlw"; - rev = "7af7d76dcf9cc71ddada3aa4a38abf46f65550ca"; - fetchSubmodules = true; - }; - isLibrary = true; - isExecutable = true; - enableSeparateDataOutput = true; - libraryHaskellDepends = [ - aeson aeson-pretty attoparsec base base64-bytestring binary - bytestring cereal containers contravariant deepseq filepath foldl - hashable haskell-src insert-ordered-containers lens mtl - neat-interpolation parsec parsers pretty pretty-show proto3-wire - QuickCheck quickcheck-instances safe swagger2 system-filepath text - time transformers turtle vector - ]; - executableHaskellDepends = [ - base containers mtl optparse-applicative optparse-generic - proto3-wire range-set-list system-filepath text turtle - ]; - testHaskellDepends = [ - aeson attoparsec base base64-bytestring bytestring cereal - containers deepseq doctest generic-arbitrary mtl pretty-show - proto3-wire QuickCheck swagger2 tasty tasty-hunit tasty-quickcheck - text transformers turtle vector - ]; - description = "A higher-level API to the proto3-wire library"; - license = lib.licenses.asl20; -} diff --git a/nix/proto3-suite.patch b/nix/proto3-suite.patch new file mode 100644 index 0000000..a2f0f71 --- /dev/null +++ b/nix/proto3-suite.patch @@ -0,0 +1,13 @@ +diff --git a/proto3-suite.cabal b/proto3-suite.cabal +index 0898741..9959935 100644 +--- a/proto3-suite.cabal ++++ b/proto3-suite.cabal +@@ -48,7 +48,7 @@ library + if flag(swagger) + exposed-modules: Proto3.Suite.DotProto.Generate.Swagger + Proto3.Suite.DotProto.Generate.Swagger.Wrappers +- build-depends: swagger2 >=2.1.6 && <2.8 ++ build-depends: swagger2 >=2.1.6 && <3 + cpp-options: -DSWAGGER + if flag(swagger-wrapper-format) + hs-source-dirs: src/swagger-wrapper-format diff --git a/nix/proto3-wire.nix b/nix/proto3-wire.nix deleted file mode 100644 index 4017955..0000000 --- a/nix/proto3-wire.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ mkDerivation, base, bytestring, cereal, containers, deepseq -, doctest, ghc-prim, hashable, lib, parameterized, primitive -, QuickCheck, safe, tasty, tasty-hunit, tasty-quickcheck, text -, transformers, unordered-containers, vector -}: -mkDerivation { - pname = "proto3-wire"; - version = "1.2.2"; - sha256 = "8d409536a89a0187f0576711966d2ef45d43acab7b6a3a1c5ee12f6d01adbfb9"; - libraryHaskellDepends = [ - base bytestring cereal containers deepseq ghc-prim hashable - parameterized primitive QuickCheck safe text transformers - unordered-containers vector - ]; - testHaskellDepends = [ - base bytestring cereal doctest QuickCheck tasty tasty-hunit - tasty-quickcheck text transformers vector - ]; - description = "A low-level implementation of the Protocol Buffers (version 3) wire format"; - license = lib.licenses.asl20; -} diff --git a/nix/proto3-wire.patch b/nix/proto3-wire.patch new file mode 100644 index 0000000..7c88993 --- /dev/null +++ b/nix/proto3-wire.patch @@ -0,0 +1,13 @@ +diff --git a/proto3-wire.cabal b/proto3-wire.cabal +index 6db123a..9d7c958 100644 +--- a/proto3-wire.cabal ++++ b/proto3-wire.cabal +@@ -55,7 +55,7 @@ test-suite tests + build-depends: base >=4.9 && <=5.0, + bytestring >=0.10.6.0 && <0.11.0, + cereal >= 0.5.1 && <0.6, +- doctest >= 0.7.0 && <0.18, ++ doctest >= 0.7.0 && <0.19, + proto3-wire, + QuickCheck >=2.8 && <3.0, + tasty >= 0.11 && <1.5, diff --git a/nixpkgs.nix b/nixpkgs.nix index 1c22faf..8993d8b 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -1,12 +1,15 @@ # Given a Git revision hash ``, you get the new SHA256 by running: # -# ```bash -# $ nix-prefetch-url "https://github.com/NixOS/nixpkgs/archive/.tar.gz" +# ``` sh +# nix-prefetch-url --unpack 'https://github.com/NixOS/nixpkgs/archive/.tar.gz' # ``` # # The SHA256 will be printed as the last line of stdout. -import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/dd9f73e7d34486b09b966738ace161e621a0480b.tar.gz"; - sha256 = "0s674386v5b24a9fia26439gw9wsyhif85k2nzpxkp61293v3n3h"; - }) +import (fetchTarball { + # Branch: release-22.05 + # Date: 2022-07-28 + # grpc.version: 1.46.3 + url = "https://github.com/NixOS/nixpkgs/archive/76e54678eb7fd4d9bfda9b13858a6a8df4501582.tar.gz"; + sha256 = "1zqjzdl9wy17v39nb7z7hsws4ydbqvjsm326x3cgh47m3d24kfhr"; +}) diff --git a/release.nix b/release.nix index 40df463..2d2de13 100644 --- a/release.nix +++ b/release.nix @@ -68,41 +68,44 @@ let overlay = pkgsNew: pkgsOld: { - grpc = pkgsNew.callPackage ./nix/grpc.nix { }; - haskellPackages = pkgsOld.haskellPackages.override { overrides = haskellPackagesNew: haskellPackagesOld: rec { - parameterized = - pkgsNew.haskell.lib.overrideCabal - haskellPackagesOld.parameterized - (old: { - broken = false; - patches = (old.patches or [ ]) ++ [ ./nix/parameterized.patch ]; - }); - haskell-src = - haskellPackagesNew.callHackage "haskell-src" "1.0.3.1" {}; + data-diverse = + pkgsNew.lib.pipe haskellPackagesOld.data-diverse [ + (haskellAddPatch pkgsNew ./nix/data-diverse.patch) + (haskellMarkUnbroken pkgsNew) + ]; proto3-wire = - haskellPackagesNew.callPackage ./nix/proto3-wire.nix { }; + pkgsNew.lib.pipe haskellPackagesOld.proto3-wire [ + (haskellAddPatch pkgsNew ./nix/proto3-wire.patch) + ]; proto3-suite = - pkgsNew.haskell.lib.dontCheck - (haskellPackagesNew.callPackage ./nix/proto3-suite.nix {}); + pkgsNew.lib.pipe haskellPackagesOld.proto3-suite [ + (haskellAddPatch pkgsNew ./nix/proto3-suite.patch) + pkgsNew.haskell.lib.dontCheck # 4 out of 74 tests failed + ]; grpc-haskell-core = - pkgsNew.haskell.lib.buildFromSdist (pkgsNew.usesGRPC - (haskellPackagesNew.callCabal2nix "grpc-haskell-core" ./core { - gpr = pkgsNew.grpc; - } - ) - ); + pkgsNew.lib.pipe ( + haskellPackagesNew.callCabal2nix "grpc-haskell-core" ./core { + gpr = pkgsNew.grpc; + } + ) [ + pkgsNew.usesGRPC + pkgsNew.haskell.lib.buildFromSdist + ]; grpc-haskell-no-tests = - pkgsNew.haskell.lib.buildFromSdist (pkgsNew.usesGRPC - (pkgsNew.haskell.lib.dontCheck - (haskellPackagesNew.callCabal2nix "grpc-haskell" ./. { }) - )); + pkgsNew.lib.pipe ( + haskellPackagesNew.callCabal2nix "grpc-haskell" ./. { } + ) [ + pkgsNew.haskell.lib.dontCheck + pkgsNew.usesGRPC + pkgsNew.haskell.lib.buildFromSdist + ]; grpc-haskell = pkgsNew.usesGRPC @@ -207,8 +210,20 @@ let ''; } ); + + # Fix this error when entering a nix-shell: + # error: mox-0.7.8 not supported for interpreter python2.7 + python = pkgsNew.python3; }; + haskellAddPatch = pkgs: patchFile: + pkgs.lib.flip pkgs.haskell.lib.overrideCabal (old: { + patches = (old.patches or [ ]) ++ [ patchFile ]; + }); + + haskellMarkUnbroken = pkgs: + pkgs.lib.flip pkgs.haskell.lib.overrideCabal (old: { broken = false; }); + overlays = [ overlay ]; config = { }; @@ -218,6 +233,21 @@ let darwinPkgs = nixpkgs { inherit config overlays; system = "x86_64-darwin"; }; pkgs = nixpkgs { inherit config overlays; }; + shell = pkgs.haskellPackages.shellFor { + name = "gRPC-haskell-shell"; + withHoogle = true; + + packages = p: [ + p.grpc-haskell-core + p.grpc-haskell + ]; + + buildInputs = [ + pkgs.cabal-install + pkgs.grpc + ]; + }; + in { grpc-haskell-core-linux = linuxPkgs.haskellPackages.grpc-haskell-core; @@ -234,6 +264,6 @@ in grpc = pkgs.grpc; - inherit pkgs config overlay; + inherit pkgs config overlay shell; inherit (pkgs) test-grpc-haskell; }