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
47 changes: 43 additions & 4 deletions templates/haskell/.config/project/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,56 @@
project = {
name = "{{project.name}}";
summary = "{{project.summary}}";
## TODO: Move something like this to Flaky.
file = let
copyLicenses = dir: {
## Cabal requires many files to exist at the package level, rather than
## the repo level. This makes copies of the individual files into the
## package directory.
##
## TODO: Move something like this to Flaky.
perPackageFiles = dir: {
"${dir}/LICENSE".source = ../../LICENSE;
"${dir}/LICENSE.AGPL-3.0-only".source = ../../LICENSE.AGPL-3.0-only;
"${dir}/LICENSE.Universal-FOSS-exception-1.0".source =
../../LICENSE.Universal-FOSS-exception-1.0;
"${dir}/LICENSE.commercial".source = ../../LICENSE.commercial;
"${dir}/LICENSE.proprietary".source = ../../LICENSE.proprietary;
## We might want to put this somewhere else (like .config/henforcer/),
## but that isn’t currently an option, because of flipstone/henforcer#7.
"${dir}/henforcer.toml".text =
lib.pm.generators.toTOML {} {
globalSection = {};
sections = {
forAnyModule = {
## doesn’t yet support nested attr sets
# allowedAliasUniqueness.allAliasesUniqueExcept = [];
maximumExportsPlusHeaderUndocumented = 0;
maximumExportsWithoutSince = 0;
moduleHeaderCopyrightMustExistNonEmpty = true;
## We want to require a description, but just a “normal”
## description, not the header field.
moduleHeaderDescriptionMustExistNonEmpty = false;
moduleHeaderLicenseMustExistNonEmpty = true;
};
};
}
## NB: `toTOML` is really just an INI generator, so it can’t handle a
## lot of syntax. This tacks some bits onto the end that the INI
## generator does’t like.
+ ''
# Exclude auto-generated `Paths` module
[[forPatternModules]]
pattern = "Paths_*"
[forPatternModules.rulesToIgnore]
all = true

# Exclude auto-generated `Build_doctests` module
[[forSpecifiedModules]]
module = "Build_doctests"
[forSpecifiedModules.rulesToIgnore]
all = true
'';
};
in
copyLicenses "core";
perPackageFiles "core";
};

imports = [./hlint.nix];
Expand Down
2 changes: 1 addition & 1 deletion templates/haskell/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LicenseListVersion: 3.27.0
SPDX-License-Identifier: AGPL-3.0-only WITH Universal-FOSS-exception-1.0 OR LicenseRef-commercial
SPDX-License-Identifier: AGPL-3.0-only WITH Universal-FOSS-exception-1.0 OR LicenseRef-proprietary

The individual licenses are included in files named “LICENSE.” with a suffix
that matches each license’s identifier.
Expand Down
3 changes: 0 additions & 3 deletions templates/haskell/LICENSE.commercial

This file was deleted.

3 changes: 3 additions & 0 deletions templates/haskell/LICENSE.proprietary
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This software is available for proprietary licensing with flexible terms.

Contact licensing@technomadic.org for more information.
11 changes: 8 additions & 3 deletions templates/haskell/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ max-backjumps: -1
minimize-conflict-set: true
reorder-goals: true

-- Maximize parallelism
jobs: $ncpus
if impl(ghc >= 9.8)
semaphore: True

flags:
-- Ensure development of this project always uses @NoRecursion@, even if it
-- causes the solver to fail.
+verify-no-recursion
-- Ensure development of this project always uses linters, even if it causes
-- the solver to fail.
+lint

program-options
ghc-options:
Expand Down
26 changes: 14 additions & 12 deletions templates/haskell/core/{{project.name}}.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ cabal-version: 3.0
name: {{project.name}}
version: 0.0.1.0
synopsis: {{project.summary}}
description: {{project.description}}
description:
{{project.description}}
maintainer: Greg Pfeil <greg@technomadic.org>
author: Greg Pfeil <greg@technomadic.org>
copyright: 2025 Greg Pfeil
-- TODO: Remove the redundant `OR AGPL-3.0-only` once
-- haskell/hackage-server#1440 is fixed.
license: AGPL-3.0-only WITH Universal-FOSS-exception-1.0 OR AGPL-3.0-only OR LicenseRef-commercial
license: AGPL-3.0-only WITH Universal-FOSS-exception-1.0 OR LicenseRef-proprietary
license-files:
LICENSE
LICENSE.AGPL-3.0-only
LICENSE.Universal-FOSS-exception-1.0
LICENSE.commercial
LICENSE.proprietary
category:
build-type: Custom
extra-doc-files:
Expand Down Expand Up @@ -85,9 +84,9 @@ flag noisy-deprecations
-- Because disabling this flag won’t help the solver.
manual: True

flag verify-no-recursion
flag lint
description:
Compile with "NoRecursion" enabled. This is intended for developers of this
Build with linting plugins enabled. This is intended for developers of this
package.
default: False
-- Because disabling this flag won’t help the solver.
Expand Down Expand Up @@ -204,11 +203,16 @@ common defaults
if flag(noisy-deprecations)
cpp-options:
-DSELLOUT_NOISY_DEPRECATIONS
if flag(verify-no-recursion)
if flag(lint)
build-depends:
no-recursion,
ghc-options:
-fplugin=NoRecursion
if impl(ghc >= 9.4)
build-depends:
henforcer ^>= {1.0.0},
ghc-options:
-fplugin Henforcer

library
import: defaults
Expand All @@ -226,6 +230,8 @@ test-suite doctests
build-depends:
doctest,
{{project.name}},
ghc-options:
-fno-warn-missing-import-lists
if impl(ghc >= 8.10.1)
ghc-options:
-- `doctest` requires the package containing the doctests as a dependency
Expand All @@ -237,11 +243,7 @@ test-suite doctests
-- all of its warnings one way or another.
if impl(ghc >= 8.0.1)
ghc-options:
-Wno-missing-import-lists
-Wno-safe
else
ghc-options:
-fno-warn-missing-import-lists
if impl(ghc >= 8.4.1)
ghc-options:
-Wno-missing-export-lists
Expand Down
Loading