Skip to content
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

Update build for GHC 9.6.+ #71

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ 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"]
ghc: ["8.8", "8.10", "9.0", "9.2", "9.4", "9.6"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{matrix.ghc}}
cancel-in-progress: true
env:
CONFIG: "--enable-tests"
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2.3
- uses: haskell-actions/setup@v2.5.1
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: false
- run: cabal v2-update
- run: cabal v2-freeze $CONFIG
- uses: actions/cache@v3
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
fail-fast: false
matrix:
ghc:
- ghc902
- ghc924
- ghc942
- ghc90
- ghc92
- ghc94
- ghc96
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.ghc }}
cancel-in-progress: true
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.

65 changes: 27 additions & 38 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 = ["ghc90" "ghc92" "ghc94" "ghc96"];

eachSystem = nixpkgs.lib.genAttrs systems;

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

pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system});

haskellPackages = eachSystem (
system: let
pkgs = pkgsBySystem.${system};
inherit (pkgs.haskell.lib) appendPatch;
in
eachHaskell (
haskell:
pkgs.haskell.packages.${haskell}.override (prev: {
overrides = _: hprev: {
# Wants bytestring <0.12
cmark-gfm = appendPatch hprev.cmark-gfm ./nix/cmark-gfm-cabal.patch;
};
})
)
);
in {
packages = eachSystem (
system: let
pkgs = pkgsBySystem.${system};

moats = builtins.listToAttrs (map (haskell: {
name = "moat-${haskell}";
value = pkgs.haskell.packages.${haskell}.callPackage ./moat.nix {};
moats =
nixpkgs.lib.mapAttrs'
(n: v: {
name = "moat-${n}";
value = v;
})
haskells);
(eachHaskell (
haskell:
haskellPackages.${system}.${haskell}.callPackage ./moat.nix {}
));
in
moats // {default = moats."moat-${latestHaskell}";}
);

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

enableSeparateBinOutput = drv:
if (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64)
then overrideCabal drv (_: {enableSeparateBinOutput = false;})
else drv;

haskellOverlays = {
ghc902 = hself: hsuper: {
# 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;
hls-fourmolu-plugin = dontCheck hsuper.hls-fourmolu-plugin;
};
ghc942 = hself: hsuper: {
# https://github.com/NixOS/nixpkgs/issues/140774
ghcid = dontCheck (enableSeparateBinOutput hsuper.ghcid);
};
};

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