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

27 changes: 17 additions & 10 deletions templates/haskell/.config/flake/outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ in
## one via GitHub workflow. Additionally, check any revisions that have
## explicit conditionalization. And check whatever version `pkgs.ghc`
## maps to in the nixpkgs we depend on.
testedGhcVersions = system: [
self.lib.defaultGhcVersion
"9.4.8"
"9.6.7"
"9.8.4"
"9.10.2"
"9.12.2"
# "ghcHEAD" # doctest doesn’t work on current HEAD
];
testedGhcVersions = system:
[
self.lib.defaultGhcVersion
"9.4.8"
"9.6.7"
"9.8.4"
"9.10.2"
]
++ nixpkgs.lib.optionals (system != "i686-linux") [
"9.12.2" # GHC fails to build on i686-linux
];

## The versions that are older than those supported by Nix that we
## prefer to test against.
Expand Down Expand Up @@ -170,7 +172,12 @@ in
[self.projectConfigurations.${system}.packages.path]
## NB: Haskell Language Server no longer supports GHC <9.6.
++ nixpkgs.lib.optional
(nixpkgs.lib.versionAtLeast hpkgs.ghc.version "9.6")
(nixpkgs.lib.versionAtLeast hpkgs.ghc.version "9.6"
## TODO: With Nixpkgs 25.11, HLS complains about conflicting package
## versions in these combinations, so skip it.
&& !(pkgs.stdenv.hostPlatform.isLinux
&& nixpkgs.lib.versionAtLeast hpkgs.ghc.version "9.8"
&& nixpkgs.lib.versionOlder hpkgs.ghc.version "9.10"))
hpkgs.haskell-language-server);

projectConfigurations =
Expand Down
33 changes: 28 additions & 5 deletions templates/haskell/.config/project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,39 @@
"check-licenses"
]
++ lib.concatMap (sys:
lib.concatMap (ghc: [
"build (${ghc}, ${sys})"
"build (--prefer-oldest, ${ghc}, ${sys})"
])
lib.concatMap (ghc:
## Don’t add `exclude`d matrix entries to the required list
##
## TODO: Make this less manual (like the `include` component).
if
## GHC before 8.4 needs an older Ubuntu
lib.versionOlder ghc "8.4"
&& sys == "ubuntu-24.04"
## GHC doesn’t support ARM before GHC 9.2.
|| lib.versionOlder ghc "9.2"
&& builtins.elem sys ["macos-15" "ubuntu-24.04-arm"]
## GHC 9.2.1 relied on libnuma at runtime for aarch64
|| ghc == "9.2.1" && sys == "ubuntu-24.04-arm"
then []
else [
"build (${ghc}, ${sys})"
"build (--prefer-oldest, ${ghc}, ${sys})"
])
self.lib.nonNixTestedGhcVersions)
config.services.haskell-ci.systems);
config.services.haskell-ci.systems
## Add `include`d matrix entries to the required list.
++ map (
entry:
if entry.bounds == ""
then "build (${entry.ghc}, ${entry.os})"
else "build (${entry.bounds}, ${entry.ghc}, ${entry.os})"
)
config.services.haskell-ci.include);
services.haskell-ci = {
inherit (self.lib) defaultGhcVersion;
ghcVersions = self.lib.nonNixTestedGhcVersions;
cabalPackages = {"${config.project.name}" = "core";};
## The latest Stackage LTS that we also build on GitHub for.
latestGhcVersion = "9.10.1";
};

Expand Down
18 changes: 13 additions & 5 deletions templates/haskell/.config/project/hlint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@
};
}

{ignore = {name = "Eta reduce";};}
{ignore = {name = "Evaluate";};}
{ignore = {name = "Reduce duplication";};}
{ignore = {name = "Use list comprehension";};}
{ignore = {name = "Use section";};}
{
ignore.name = [
## This can be removed once we no longer support ≤ base 4.18, which
## doesn’t yet export `Data.Functor.unzip`.
"Avoid NonEmpty.unzip"
## This complains when we use a common import and then import from the
## same module under a CPP conditional. Since Ormolu handles combinig
## imports when possible anyway, this warning isn’t helpful.
"Use fewer imports"
## I just don’t like them (even the monadic variant).
"Use list comprehension"
];
}

{
package = {
Expand Down
4 changes: 3 additions & 1 deletion templates/haskell/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ and this project adheres to the [Haskell Package Versioning Policy](https://pvp.

- initial release of this package

[0.0.1.0]: https://github.com/{{project.repo}}/releases/tag/v0.0.1.0
<!-- NB: The version on the left is the Haskell package version (PVP), the version on the right is the repo (tag) version (SemVer). Their only relationship is that a change of any severity on the left implies a change of at least that severity on the right. -->

[0.0.1.0]: https://github.com/{{project.repo}}/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion templates/haskell/core/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# {{project.name}}

[![Hackage Version](https://img.shields.io/hackage/v/{{project.name}})](https://hackage.haskell.org/package/{{project-name}})
[![Hackage Version](https://img.shields.io/hackage/v/{{project.name}})](https://hackage.haskell.org/package/{{project.name}})
[![Packaging status](https://repology.org/badge/tiny-repos/haskell:{{project.name}}.svg)](https://repology.org/project/haskell:{{project.name}}/versions)
[![latest packaged versions](https://repology.org/badge/latest-versions/haskell:{{project.name}}.svg)](https://repology.org/project/haskell:{{project.name}}/versions)

Expand Down
30 changes: 18 additions & 12 deletions templates/haskell/core/{{project.name}}.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ tested-with:

homepage: https://github.com/{{project.repo}}#readme
bug-reports: https://github.com/{{project.repo}}/issues

source-repository head
type: git
location: https://github.com/{{project.repo}}.git
subdir: core

source-repository this
type: git
location: https://github.com/{{project.repo}}.git
subdir: core
-- NB: This is the repo version, which is distinct from the package version.
tag: v0.1.0

custom-setup
setup-depends:
-- TODO: Due to haskell/cabal#3751, `Cabal` has to be specified even though
Expand Down Expand Up @@ -139,7 +147,11 @@ common defaults
import: GHC2024
build-depends:
base ^>= {4.8.2, 4.9.0, 4.10.0, 4.11.0, 4.12.0, 4.13.0, 4.14.0, 4.15.0, 4.16.0, 4.17.0, 4.18.0, 4.19.0, 4.20.0, 4.21.0},
ghc-compat-plugin ^>= {0.1.0},
ghc-options:
-fplugin GhcCompat
-fplugin-opt GhcCompat:minVersion=7.10.3
-fplugin-opt GhcCompat:reportIncompatibleExtensions=error
if impl(ghc >= 8.0.1)
ghc-options:
-Weverything
Expand All @@ -157,20 +169,14 @@ common defaults
else
ghc-options:
-Wall
-- remove if the oldest supported version is GHC 8.10.1+
if impl(ghc >= 8.10.1)
ghc-options:
-Wno-prepositive-qualified-module
-- remove if the oldest supported version is GHC 9.2.1+
if impl(ghc >= 9.2.1)
if impl(ghc >= 8.6.1)
ghc-options:
-Wno-missing-kind-signatures
if impl(ghc >= 9.8.1)
-- remove if oldest supported version is GHC 8.6.1
-Wno-star-is-type
if impl(ghc >= 8.8.1)
ghc-options:
-- remove if the oldest supported version is GHC 9.2.1+
-Wno-missing-poly-kind-signatures
-- Inference good.
-Wno-missing-role-annotations
-- remove if oldest supported version is GHC 8.2.1
-Wno-missing-deriving-strategies
default-extensions:
-- BlockArguments - uncomment if the oldest supported version is GHC 8.6.1+
DefaultSignatures
Expand Down