Skip to content

Commit

Permalink
0.8.1: dependency fixes including dhall-1.42 (awakesecurity#251)
Browse files Browse the repository at this point in the history
Also, in shell.nix default to GHC 9.4.8.
  • Loading branch information
j6carey authored Aug 2, 2024
1 parent bec9d40 commit 5d6cf79
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- ghc902
- ghc928
- ghc948
- ghc962
- ghc981
- ghc965
- ghc982
dhall:
- false
- true
Expand All @@ -32,11 +32,11 @@ jobs:
exclude:
- swagger: false
swaggerWrapper: true
- compiler: ghc962
- compiler: ghc965
largeRecords: true
- compiler: ghc981
- compiler: ghc982
largeRecords: true
- compiler: ghc981
- compiler: ghc982
dhall: true
- compiler: ghc902
os: macos-latest
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.8.1
* Fix support for dhall-1.42.
* Fix aeson upper bound in library target (was correct in test target).
* Fix default compiler version in shell.nix.
* Test with GHC 9.8.2 instead of GHC 9.8.1 and GHC 9.6.5 instead of GHC 9.6.2.
* Test with nixpkgs-24.05 but always using aeson-2.1.2.1.

# 0.8.0
* [BREAKING CHANGE: Use "ghc" library in place of "haskell-src".]
The "ghc" library is now used to parse and print Haskell source code.
Expand Down
9 changes: 5 additions & 4 deletions nix/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ args:

let
nixpkgs = builtins.fetchTarball {
# build: https://hydra.nixos.org/build/258096332
# commit: 0638fe2715d998fa81d173aad264eb671ce2ebc1
url = "https://hydra.nixos.org/build/258096332/download/2/nixpkgs-23.11pre558121.0638fe2715d9.tar.xz";
sha256 = "1z3s1hqg3b72g608pf9sv474d4y9s00p86nsvfw5i9xgwhjncjjb";
# from: https://hydra.nixos.org/job/nixos/release-24.05/nixpkgs.tarball
# build: https://hydra.nixos.org/build/262713240
# commit: cc54fb41d13736e92229c21627ea4f22199fee6b
url = "https://hydra.nixos.org/build/262713240/download/2/nixpkgs-24.05pre631579.cc54fb41d137.tar.xz";
sha256 = "01jgwy8ixfnl7dig5qhih34lrx2g9xpj64yr49n0lyvpwj44s475";
};
in import nixpkgs ({ config = { }; } // args)
25 changes: 23 additions & 2 deletions nix/overlays/haskell-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,28 @@ in {
pkgsNew.haskell.lib.dontCheck haskellPackagesOld.adjunctions;

# With nixpkgs-23.11 and ghc981, aeson-2.1.2.1 thinks that th-abstraction is out of bounds.
#
# Also, in order to avoid the breaking change to package structure in aeson-2.2.0.0,
# we patch the import list of aeson-2.1.2.1.
#
# And we disable tests because explicitly specifying aeson-2.1.2.1
# seems to trigger a test failure, at least on GHC 9.4.8 and 9.8.1;
# perhaps somewhere in nixpkgs the test is suppressed and
# overriding the Nix definition re-enables testing?
#
# encodeDouble: FAIL
# *** Failed! Falsified (after 15 tests and 2 shrinks):
# 1.0
# 0.0
# "\"+inf\"" /= "null"
# Use --quickcheck-replay=305830 to reproduce.
# Use -p '/encodeDouble/' to rerun this test only.
#
aeson =
pkgsNew.haskell.lib.doJailbreak
( pkgsNew.haskell.lib.appendPatches haskellPackagesOld.aeson
[ ../patches/aeson-2.1.2.1.patch ] );
( pkgsNew.haskell.lib.dontCheck
( pkgsNew.haskell.lib.appendPatches haskellPackagesOld.aeson
[ ../patches/aeson-2.1.2.1.patch ] ) );

# With nixpkgs-23.11 and ghc981, atomic-write wants hspec for testing,
# which causes problems.
Expand Down Expand Up @@ -169,6 +185,11 @@ in {
neat-interpolation =
pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.neat-interpolation;

# With GHC 9.0/9.2, "network-uri" with testing enabled would find that
# "th-compat" wants an older version of "directory" than does "process".
network-uri =
pkgsNew.haskell.lib.dontCheck haskellPackagesOld.network-uri;

# With nixpkgs-23.11 and our overrides, rerebase that rebase is out of bounds.
rerebase =
pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.rerebase;
Expand Down
38 changes: 38 additions & 0 deletions nix/packages/aeson.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ mkDerivation, attoparsec, base, base-compat
, base-compat-batteries, base-orphans, base16-bytestring
, bytestring, containers, data-fix, deepseq, Diff, directory, dlist
, exceptions, filepath, generic-deriving, generically, ghc-prim
, hashable, indexed-traversable, integer-logarithms, lib, OneTuple
, primitive, QuickCheck, quickcheck-instances, scientific
, semialign, strict, tagged, tasty, tasty-golden, tasty-hunit
, tasty-quickcheck, template-haskell, text, text-short
, th-abstraction, these, time, time-compat, unordered-containers
, uuid-types, vector, witherable
}:
mkDerivation {
pname = "aeson";
version = "2.1.2.1";
sha256 = "5d4042b903ce181ee023bbf908f37a3f55e820c5f0df102683b87f963e3522c6";
revision = "3";
editedCabalFile = "19qj4s625b34kw8ryb2ji0hs6dg2m116x913s722bab316k653av";
libraryHaskellDepends = [
attoparsec base base-compat-batteries bytestring containers
data-fix deepseq dlist exceptions generically ghc-prim hashable
indexed-traversable OneTuple primitive QuickCheck scientific
semialign strict tagged template-haskell text text-short
th-abstraction these time time-compat unordered-containers
uuid-types vector witherable
];
testHaskellDepends = [
attoparsec base base-compat base-orphans base16-bytestring
bytestring containers data-fix Diff directory dlist filepath
generic-deriving generically ghc-prim hashable indexed-traversable
integer-logarithms OneTuple primitive QuickCheck
quickcheck-instances scientific strict tagged tasty tasty-golden
tasty-hunit tasty-quickcheck template-haskell text text-short these
time time-compat unordered-containers uuid-types vector
];
homepage = "https://github.com/haskell/aeson";
description = "Fast JSON parsing and encoding";
license = lib.licenses.bsd3;
}
11 changes: 11 additions & 0 deletions nix/packages/attoparsec-aeson.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ mkDerivation, aeson, base, lib }:
mkDerivation {
pname = "attoparsec-aeson";
version = "2.1.0.0";
sha256 = "b34afb1c330428d9ff7e9e99655ece826ed7a1928dd5880c8127e73a12e906a9";
libraryHaskellDepends = [ aeson base ];
doHaddock = false;
homepage = "https://github.com/haskell/aeson";
description = "Parsing of aeson's Value with attoparsec";
license = lib.licenses.bsd3;
}
4 changes: 2 additions & 2 deletions proto3-suite.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: proto3-suite
version: 0.8.0
version: 0.8.1
synopsis: A higher-level API to the proto3-wire library
description:
This library provides a higher-level API to <https://github.com/awakesecurity/proto3-wire the `proto3-wire` library>
Expand Down Expand Up @@ -100,7 +100,7 @@ library

other-modules: Turtle.Compat

build-depends: aeson >= 1.1.1.0 && < 2.3,
build-depends: aeson >= 1.1.1.0 && < 2.2,
aeson-pretty,
attoparsec >= 0.13.0.1,
base >=4.15 && <5.0,
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# $ nix-shell --arg fast true
#
{ fast ? false
, compiler ? "ghc8107"
, compiler ? "ghc948"
, enableDhall ? false
, enableSwagger ? true
, swaggerWrapperFormat ? false
Expand Down
10 changes: 10 additions & 0 deletions src/Proto3/Suite/DhallPB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import Dhall (FromDhall (..), ToDhall (..))
import GHC.Float (double2Float, float2Double)
import Proto3.Suite.Types (Enumerated (..), Fixed (..))

#if !(MIN_VERSION_dhall(1,42,0))
import qualified Data.ByteString
import qualified Data.ByteString.Base64
import qualified Data.ByteString.Base64.Lazy
import qualified Data.ByteString.Lazy
import qualified Data.Text.Encoding
import qualified Data.Text.Lazy.Encoding
#endif
import qualified Dhall

#if !(MIN_VERSION_dhall(1,27,0))
Expand Down Expand Up @@ -63,6 +65,8 @@ instance Dhall.FromDhall a => Dhall.FromDhall (Enumerated a)

instance Dhall.FromDhall a => Dhall.FromDhall (Either Int32 a)

#if !(MIN_VERSION_dhall(1,42,0))

--------------------------------------------------------------------------------
-- Interpret the strict and lazy ByteString types
--
Expand All @@ -80,6 +84,8 @@ instance Dhall.FromDhall Data.ByteString.ByteString where
where
b64Decode = Data.ByteString.Base64.decodeLenient . Data.Text.Encoding.encodeUtf8

#endif

--------------------------------------------------------------------------------
-- Interpret integer scalar types

Expand Down Expand Up @@ -182,6 +188,8 @@ instance Dhall.ToDhall (Fixed Word64) where
instance Dhall.ToDhall Float where
injectWith = fmap (contramap float2Double) Dhall.injectWith

#if !(MIN_VERSION_dhall(1,42,0))

--------------------------------------------------------------------------------
-- Inject strict and lazy ByteStrings
--
Expand All @@ -205,6 +213,8 @@ instance Dhall.ToDhall Data.ByteString.ByteString where
-- because we Base64 encode the ByteString first
b64Encode = Data.Text.Encoding.decodeUtf8 . Data.ByteString.Base64.encode

#endif

#if !(MIN_VERSION_dhall(1,27,0))
--------------------------------------------------------------------------------
-- Inject maps
Expand Down

0 comments on commit 5d6cf79

Please sign in to comment.