From af115b860978ca7eb9bbcb776e07bd67a7e8af39 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 17 Aug 2021 08:58:54 +0200 Subject: [PATCH] haskellPackages.graphql-engine: 2.0.5 -> 2.0.7 --- .../haskell-modules/configuration-common.nix | 17 ++++-- .../haskell-modules/non-hackage-packages.nix | 14 ++--- .../patches/graphql-engine-mapkeys.patch | 38 +++++++++--- .../misc/haskell/hasura/ekg-core.nix | 33 ++++++++++ .../misc/haskell/hasura/ekg-json.nix | 21 +++++++ .../misc/haskell/hasura/graphql-engine.nix | 60 +++++++++---------- .../development/misc/haskell/hasura/update.sh | 20 ++++++- 7 files changed, 148 insertions(+), 55 deletions(-) create mode 100644 pkgs/development/misc/haskell/hasura/ekg-core.nix create mode 100644 pkgs/development/misc/haskell/hasura/ekg-json.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 59e95dcc3d77..e6104f1e18e7 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1288,14 +1288,23 @@ self: super: { Spock-core = dontCheck super.Spock-core; # hasura packages need some extra care - graphql-engine = overrideCabal (super.graphql-engine.override { + graphql-engine = overrideCabal (super.graphql-engine.overrideScope (self: super: { immortal = self.immortal_0_2_2_1; - }) (drv: { + resource-pool = self.hasura-resource-pool; + ekg-core = self.hasura-ekg-core; + ekg-json = self.hasura-ekg-json; + hspec = dontCheck self.hspec_2_8_3; + hspec-core = dontCheck self.hspec-core_2_8_3; + hspec-discover = dontCheck super.hspec-discover_2_8_3; + tasty-hspec = self.tasty-hspec_1_2; + })) (drv: { patches = [ ./patches/graphql-engine-mapkeys.patch ]; doHaddock = false; - version = "2.0.5"; + version = "2.0.7"; }); - pg-client = overrideCabal super.pg-client (drv: { + pg-client = overrideCabal (super.pg-client.override { + resource-pool = self.hasura-resource-pool; + }) (drv: { librarySystemDepends = with pkgs; [ postgresql krb5.dev openssl.dev ]; # wants a running DB to check against doCheck = false; diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 48ee2ee3a474..4aead5d18800 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -28,17 +28,13 @@ self: super: { # hasura graphql-engine is not released to hackage. # https://github.com/hasura/graphql-engine/issues/7391 - # - # pg-client and graphql-engine depend on a hasura fork of resource-pool - # which is provided by pool.nix ci-info = self.callPackage ../misc/haskell/hasura/ci-info.nix {}; - pg-client = self.callPackage ../misc/haskell/hasura/pg-client.nix { - resource-pool = self.callPackage ../misc/haskell/hasura/pool.nix {}; - }; + pg-client = self.callPackage ../misc/haskell/hasura/pg-client.nix {}; graphql-parser = self.callPackage ../misc/haskell/hasura/graphql-parser.nix {}; - graphql-engine = self.callPackage ../misc/haskell/hasura/graphql-engine.nix { - resource-pool = self.callPackage ../misc/haskell/hasura/pool.nix {}; - }; + graphql-engine = self.callPackage ../misc/haskell/hasura/graphql-engine.nix {}; + hasura-resource-pool = self.callPackage ../misc/haskell/hasura/pool.nix {}; + hasura-ekg-core = self.callPackage ../misc/haskell/hasura/ekg-core.nix {}; + hasura-ekg-json = self.callPackage ../misc/haskell/hasura/ekg-json.nix {}; # Unofficial fork until PRs are merged https://github.com/pcapriotti/optparse-applicative/pulls/roberth # cabal2nix --maintainer roberth https://github.com/hercules-ci/optparse-applicative.git > pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix diff --git a/pkgs/development/haskell-modules/patches/graphql-engine-mapkeys.patch b/pkgs/development/haskell-modules/patches/graphql-engine-mapkeys.patch index 5fcf408b2b0e..9035185dc2d5 100644 --- a/pkgs/development/haskell-modules/patches/graphql-engine-mapkeys.patch +++ b/pkgs/development/haskell-modules/patches/graphql-engine-mapkeys.patch @@ -1,13 +1,33 @@ diff --git a/server/src-lib/Data/HashMap/Strict/Extended.hs b/server/src-lib/Data/HashMap/Strict/Extended.hs -index eaff0dfba..5047a0e9d 100644 +index eaff0dfba..9902cadd0 100644 --- a/src-lib/Data/HashMap/Strict/Extended.hs +++ b/src-lib/Data/HashMap/Strict/Extended.hs -@@ -17,7 +17,7 @@ import qualified Data.Align as A - import qualified Data.Foldable as F +@@ -7,7 +7,6 @@ module Data.HashMap.Strict.Extended + , groupOnNE + , differenceOn + , lpadZip +- , mapKeys + , unionsWith + ) where - import Data.Function --import Data.HashMap.Strict as M -+import Data.HashMap.Strict as M hiding (mapKeys) - import Data.Hashable - import Data.List.NonEmpty (NonEmpty (..)) - import Data.These +@@ -54,20 +53,6 @@ lpadZip left = catMaybes . flip A.alignWith left \case + That b -> Just (Nothing, b) + These a b -> Just (Just a, b) + +--- | @'mapKeys' f s@ is the map obtained by applying @f@ to each key of @s@. +--- +--- The size of the result may be smaller if @f@ maps two or more distinct +--- keys to the same new key. In this case the value at the greatest of the +--- original keys is retained. +--- +--- > mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")] +--- > mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c" +--- > mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "c" +--- +--- copied from https://hackage.haskell.org/package/containers-0.6.4.1/docs/src/Data.Map.Internal.html#mapKeys +-mapKeys :: (Ord k2, Hashable k2) => (k1 -> k2) -> HashMap k1 a -> HashMap k2 a +-mapKeys f = fromList . foldrWithKey (\k x xs -> (f k, x) : xs) [] +- + -- | The union of a list of maps, with a combining operation: + -- (@'unionsWith' f == 'Prelude.foldl' ('unionWith' f) 'empty'@). + -- diff --git a/pkgs/development/misc/haskell/hasura/ekg-core.nix b/pkgs/development/misc/haskell/hasura/ekg-core.nix new file mode 100644 index 000000000000..5fa8a21aa4ec --- /dev/null +++ b/pkgs/development/misc/haskell/hasura/ekg-core.nix @@ -0,0 +1,33 @@ +# This has been automatically generated by the script +# ./update.sh. This should not be changed by hand. +{ mkDerivation, async, atomic-primops, base, containers, criterion +, fetchgit, generic-random, ghc-prim, hashable, hspec +, hspec-smallcheck, HUnit, inspection-testing, lib, markdown-unlit +, primitive, QuickCheck, smallcheck, text, unordered-containers +}: +mkDerivation { + pname = "ekg-core"; + version = "0.1.1.7"; + src = fetchgit { + url = "https://github.com/hasura/ekg-core.git"; + sha256 = "1s58kjg1kbhsyfyj0zwhnnws9hg9zwj9jylpwicg54yi78w962ys"; + rev = "9fc8f94685c149a909b66bad4167455d8ae1002c"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ + atomic-primops base containers ghc-prim hashable inspection-testing + primitive text unordered-containers + ]; + testHaskellDepends = [ + async atomic-primops base containers generic-random ghc-prim + hashable hspec hspec-smallcheck HUnit inspection-testing + markdown-unlit primitive QuickCheck smallcheck text + unordered-containers + ]; + testToolDepends = [ markdown-unlit ]; + benchmarkHaskellDepends = [ base criterion ]; + doHaddock = false; + homepage = "https://github.com/tibbe/ekg-core"; + description = "Tracking of system metrics"; + license = lib.licenses.bsd3; +} diff --git a/pkgs/development/misc/haskell/hasura/ekg-json.nix b/pkgs/development/misc/haskell/hasura/ekg-json.nix new file mode 100644 index 000000000000..0225ee6e7832 --- /dev/null +++ b/pkgs/development/misc/haskell/hasura/ekg-json.nix @@ -0,0 +1,21 @@ +# This has been automatically generated by the script +# ./update.sh. This should not be changed by hand. +{ mkDerivation, aeson, base, ekg-core, fetchgit, lib, text +, unordered-containers, vector +}: +mkDerivation { + pname = "ekg-json"; + version = "0.1.0.7"; + src = fetchgit { + url = "https://github.com/hasura/ekg-json.git"; + sha256 = "1yf9x7gh66q27c3wv5m00ijf2qpiwm53jjlhrj2yc1glv684wf4v"; + rev = "f25b9ddb7aae18059ef707a5ce30d6a54a63db13"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ + aeson base ekg-core text unordered-containers vector + ]; + homepage = "https://github.com/tibbe/ekg-json"; + description = "JSON encoding of ekg metrics"; + license = lib.licenses.bsd3; +} diff --git a/pkgs/development/misc/haskell/hasura/graphql-engine.nix b/pkgs/development/misc/haskell/hasura/graphql-engine.nix index 285094874e99..d8faf1714510 100644 --- a/pkgs/development/misc/haskell/hasura/graphql-engine.nix +++ b/pkgs/development/misc/haskell/hasura/graphql-engine.nix @@ -6,32 +6,32 @@ , bytestring, case-insensitive, ci-info, containers, cron , cryptonite, data-has, deepseq, dependent-map, dependent-sum , directory, ekg-core, ekg-json, exceptions, fast-logger, fetchgit -, file-embed, filepath, generic-arbitrary, ghc-heap-view -, graphql-parser, hashable, hashable-time, hspec, hspec-core -, hspec-expectations, hspec-expectations-lifted, http-api-data -, http-client, http-client-tls, http-conduit, http-types, immortal +, file-embed, filepath, ghc-heap-view, graphql-parser, hashable +, hashable-time, hspec, hspec-core, hspec-expectations +, hspec-expectations-lifted, http-api-data, http-client +, http-client-tls, http-conduit, http-types, immortal , insert-ordered-containers, jose, kan-extensions, lens, lens-aeson , lib, lifted-async, lifted-base, list-t, memory, mime-types , mmorph, monad-control, monad-loops, monad-validate, mtl, mustache , mysql, mysql-simple, natural-transformation, network, network-uri , odbc, optparse-applicative, pem, pg-client, postgresql-binary -, postgresql-libpq, process, profunctors, psqueues, QuickCheck -, quickcheck-instances, random, regex-tdfa, resource-pool, retry -, safe, safe-exceptions, scientific, semialign, semigroups, semver -, shakespeare, some, split, Spock-core, stm, stm-containers, tagged -, template-haskell, text, text-builder, text-conversions, these -, time, transformers, transformers-base, unix, unordered-containers -, uri-encode, utf8-string, uuid, validation, vector -, vector-instances, wai, warp, websockets, wreq, x509, x509-store -, yaml, zlib +, postgresql-libpq, pretty-simple, process, profunctors, psqueues +, QuickCheck, quickcheck-instances, random, regex-tdfa +, resource-pool, retry, safe, safe-exceptions, scientific +, semialign, semigroups, semver, shakespeare, some, split +, Spock-core, stm, stm-containers, tagged, template-haskell, text +, text-builder, text-conversions, these, time, transformers +, transformers-base, unix, unordered-containers, uri-encode +, utf8-string, uuid, validation, vector, vector-instances, wai +, warp, websockets, wreq, x509, x509-store, yaml, zlib }: mkDerivation { pname = "graphql-engine"; version = "1.0.0"; src = fetchgit { url = "https://github.com/hasura/graphql-engine.git"; - sha256 = "0sw7jwj3ixr0nnh3i9yagiqjsvf83w79jd7ac9vdvm410jfjcnxf"; - rev = "5990ca403bf6e7dd66081720c329e513f0624fb6"; + sha256 = "04s8rczvm0l5dbh14g2vav2wbqb4fg51471fncqf36s59img14b7"; + rev = "cf6f3edc1f6df7843dfb91be6dcb0fd7cc94d133"; fetchSubmodules = true; }; postUnpack = "sourceRoot+=/server; echo source root reset to $sourceRoot"; @@ -50,14 +50,14 @@ mkDerivation { memory mime-types mmorph monad-control monad-loops monad-validate mtl mustache mysql mysql-simple network network-uri odbc optparse-applicative pem pg-client postgresql-binary - postgresql-libpq process profunctors psqueues QuickCheck - quickcheck-instances random regex-tdfa resource-pool retry - safe-exceptions scientific semialign semigroups semver shakespeare - some split Spock-core stm stm-containers tagged template-haskell - text text-builder text-conversions these time transformers - transformers-base unix unordered-containers uri-encode utf8-string - uuid validation vector vector-instances wai warp websockets wreq - x509 x509-store yaml zlib + postgresql-libpq pretty-simple process profunctors psqueues + QuickCheck quickcheck-instances random regex-tdfa resource-pool + retry safe-exceptions scientific semialign semigroups semver + shakespeare some split Spock-core stm stm-containers tagged + template-haskell text text-builder text-conversions these time + transformers transformers-base unix unordered-containers uri-encode + utf8-string uuid validation vector vector-instances wai warp + websockets wreq x509 x509-store yaml zlib ]; executableHaskellDepends = [ base bytestring ekg-core kan-extensions pg-client text @@ -65,13 +65,13 @@ mkDerivation { ]; testHaskellDepends = [ aeson base bytestring containers cron dependent-map dependent-sum - generic-arbitrary graphql-parser hspec hspec-core - hspec-expectations hspec-expectations-lifted http-client - http-client-tls http-types insert-ordered-containers jose - kan-extensions lens lifted-base mmorph monad-control mtl - natural-transformation network-uri optparse-applicative pg-client - process QuickCheck safe scientific split template-haskell text time - transformers-base unordered-containers vector + graphql-parser hspec hspec-core hspec-expectations + hspec-expectations-lifted http-client http-client-tls http-types + insert-ordered-containers jose kan-extensions lens lifted-base + mmorph monad-control mtl natural-transformation network-uri + optparse-applicative pg-client process QuickCheck safe scientific + split template-haskell text time transformers-base + unordered-containers vector ]; doCheck = false; homepage = "https://www.hasura.io"; diff --git a/pkgs/development/misc/haskell/hasura/update.sh b/pkgs/development/misc/haskell/hasura/update.sh index 227d3229ebe3..c1744d5fdbfc 100755 --- a/pkgs/development/misc/haskell/hasura/update.sh +++ b/pkgs/development/misc/haskell/hasura/update.sh @@ -19,6 +19,8 @@ parser_derivation_file="${script_dir}/graphql-parser.nix" ciinfo_derivation_file="${script_dir}/ci-info.nix" pgclient_derivation_file="${script_dir}/pg-client.nix" pool_derivation_file="${script_dir}/pool.nix" +ekgcore_derivation_file="${script_dir}/ekg-core.nix" +ekgjson_derivation_file="${script_dir}/ekg-json.nix" # TODO: get current revision of graphql-engine in Nixpkgs. # old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$engine_derivation_file")" @@ -31,9 +33,7 @@ echo "Running cabal2nix and outputting to ${engine_derivation_file}..." echo "# This has been automatically generated by the script" > "$engine_derivation_file" echo "# ./update.sh. This should not be changed by hand." >> "$engine_derivation_file" -# 2.0.5 hardcoded for now, because 2.0.6 failed to build. should be removed when updating -# cabal2nix --revision "$new_version" --subpath server --maintainer lassulus "https://github.com/hasura/graphql-engine.git" >> "$engine_derivation_file" -cabal2nix --revision "v2.0.5" --subpath server --maintainer lassulus --no-check "https://github.com/hasura/graphql-engine.git" >> "$engine_derivation_file" +cabal2nix --revision "$new_version" --subpath server --maintainer lassulus --no-check "https://github.com/hasura/graphql-engine.git" >> "$engine_derivation_file" echo "Running cabal2nix and outputting to ${parser_derivation_file}..." @@ -63,6 +63,20 @@ echo "# ./update.sh. This should not be changed by hand." >> "$pool_derivation_ cabal2nix "https://github.com/hasura/pool.git" >> "$pool_derivation_file" +echo "Running cabal2nix and outputting to ${ekgcore_derivation_file}..." + +echo "# This has been automatically generated by the script" > "$ekgcore_derivation_file" +echo "# ./update.sh. This should not be changed by hand." >> "$ekgcore_derivation_file" + +cabal2nix "https://github.com/hasura/ekg-core.git" >> "$ekgcore_derivation_file" + +echo "Running cabal2nix and outputting to ${ekgjson_derivation_file}..." + +echo "# This has been automatically generated by the script" > "$ekgjson_derivation_file" +echo "# ./update.sh. This should not be changed by hand." >> "$ekgjson_derivation_file" + +cabal2nix "https://github.com/hasura/ekg-json.git" >> "$ekgjson_derivation_file" + echo "###################" echo "please update pkgs/servers/hasura/cli.nix vendorSha256" echo "please update pkgs/development/haskell-modules/configuration-common.nix graphql-engine version"