Skip to content

Commit

Permalink
Update build for GHC 9.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tadfisher committed Oct 17, 2023
1 parent 7620103 commit 3929450
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cabal: ["3.8"]
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2"]
cabal: ["3.10"]
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.4", "9.4.2", "9.6.2"]
env:
CONFIG: "--enable-tests"
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- ghc902
- ghc924
- ghc942
- ghc962
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 42 additions & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}: let
systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"];

haskells = ["ghc902" "ghc924" "ghc942"];
haskells = ["ghc902" "ghc924" "ghc942" "ghc962"];

eachSystem = nixpkgs.lib.genAttrs systems;

Expand All @@ -20,57 +20,67 @@
latestHaskell = nixpkgs.lib.last haskells;

pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system});
in {
packages = eachSystem (
system: let
pkgs = pkgsBySystem.${system};

moats = builtins.listToAttrs (map (haskell: {
name = "moat-${haskell}";
value = pkgs.haskell.packages.${haskell}.callPackage ./moat.nix {};
})
haskells);
in
moats // {default = moats."moat-${latestHaskell}";}
);

devShells = eachSystem (
haskellPackages = eachSystem (
system: let
pkgs = pkgsBySystem.${system};
inherit
(pkgs.haskell.lib)
dontCheck
overrideCabal
;
inherit (pkgs.haskell.lib) appendPatch dontCheck;

enableSeparateBinOutput = drv:
if (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64)
then overrideCabal drv (_: {enableSeparateBinOutput = false;})
else drv;
# Wants bytestring < 12
fixCmarkGfm = drv:
appendPatch drv ./nix/cmark-gfm-cabal.patch;

haskellOverlays = {
overlays = {
ghc902 = hself: hsuper: {
cmark-gfm = fixCmarkGfm hsuper.cmark-gfm;
# Wants cabal == 3.6
fourmolu = hsuper.fourmolu.overrideScope (lself: lsuper: {
Cabal = lself.Cabal_3_6_3_0;
});
};
ghc924 = hself: hsuper: {
# https://github.com/NixOS/nixpkgs/issues/140774
ghcid = enableSeparateBinOutput hsuper.ghcid;
cmark-gfm = fixCmarkGfm hsuper.cmark-gfm;
hls-fourmolu-plugin = dontCheck hsuper.hls-fourmolu-plugin;
};
ghc942 = hself: hsuper: {
# https://github.com/NixOS/nixpkgs/issues/140774
ghcid = dontCheck (enableSeparateBinOutput hsuper.ghcid);
cmark-gfm = fixCmarkGfm hsuper.cmark-gfm;
};
ghc962 = hself: hsuper: {
cmark-gfm = fixCmarkGfm hsuper.cmark-gfm;
};
};
in
eachHaskell (
haskell:
pkgs.haskell.packages.${haskell}.override (prev: {
overrides = overlays.${haskell};
})
)
);
in {
packages = eachSystem (
system: let
moats =
nixpkgs.lib.mapAttrs'
(n: v: {
name = "moat-${n}";
value = v;
})
(eachHaskell (
haskell:
haskellPackages.${system}.${haskell}.callPackage ./moat.nix {}
));
in
moats // {default = moats."moat-${latestHaskell}";}
);

devShells = eachSystem (
system: let
pkgs = pkgsBySystem.${system};

shells = eachHaskell (
haskell: let
hsPkgs = pkgs.haskell.packages.${haskell}.override (prev: {
overrides = haskellOverlays.${haskell};
});
hsPkgs = haskellPackages.${system}.${haskell};
in
pkgs.mkShell {
name = "moat-${haskell}-shell";
Expand Down
6 changes: 3 additions & 3 deletions moat.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.1.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -54,7 +54,7 @@ library
, primitive >=0.6.4 && <0.9
, template-haskell >=2.11 && <2.21
, text >=1.2 && <2.1
, th-abstraction >=0.3 && <0.6
, th-abstraction >=0.3 && <0.7
, th-compat >=0.1.0 && <0.2
, time >=1.8 && <1.13
, unordered-containers ==0.2.*
Expand Down Expand Up @@ -130,7 +130,7 @@ test-suite spec
, primitive >=0.6.4 && <0.9
, template-haskell >=2.11 && <2.21
, text >=1.2 && <2.1
, th-abstraction >=0.3 && <0.6
, th-abstraction >=0.3 && <0.7
, th-compat >=0.1.0 && <0.2
, time >=1.8 && <1.13
, unordered-containers ==0.2.*
Expand Down
13 changes: 13 additions & 0 deletions nix/cmark-gfm-cabal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/cmark-gfm.cabal b/cmark-gfm.cabal
index 23277d8..4fc84b7 100644
--- a/cmark-gfm.cabal
+++ b/cmark-gfm.cabal
@@ -69,7 +69,7 @@ library
exposed-modules: CMarkGFM
build-depends: base >=4.5 && < 5.0,
text >= 1.0 && < 2.1,
- bytestring >= 0.11.5 && < 0.12
+ bytestring
if impl(ghc < 7.6)
build-depends: ghc-prim >= 0.2
default-language: Haskell2010
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- primitive >= 0.6.4 && < 0.9
- template-haskell >= 2.11 && < 2.21
- text >= 1.2 && < 2.1
- th-abstraction >= 0.3 && < 0.6
- th-abstraction >= 0.3 && < 0.7
- th-compat >= 0.1.0 && < 0.2
- time >= 1.8 && < 1.13
- unordered-containers >= 0.2 && < 0.3
Expand Down
12 changes: 6 additions & 6 deletions src/Moat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,12 @@ consToMoatType o@Options {..} parentName parentDoc instTys variant ts bs = \case
else mkNewtypeInstance o parentDoc instTys con
Newtype -> do
if
| newtypeTag -> do
mkTypeTag o parentName instTys con
| typeAlias -> do
mkTypeAlias parentName parentDoc instTys con
| otherwise -> do
mkNewtype o parentName parentDoc instTys con
| newtypeTag -> do
mkTypeTag o parentName instTys con
| typeAlias -> do
mkTypeAlias parentName parentDoc instTys con
| otherwise -> do
mkNewtype o parentName parentDoc instTys con
_ -> do
mkProd o parentName parentDoc instTys ts con
_ -> do
Expand Down

0 comments on commit 3929450

Please sign in to comment.