@@ -0,0 +1,65 @@
1+# This provides a package set for each snapshot in Stackage.
3+# It allows you to use a bare snapshot without having to invoke
4+# mkStackPkgSet with a stack.yaml project.
6+# A particular package in a snapshot would be accessed with:
7+# snapshots."lts-13.18".conduit
9+{ lib, mkPkgSet, stackage }:
14+ mkSnapshot = name: pkg-def: (mkPkgSet {
16+ pkg-def-extras = pkg-def-extras name;
19+ # Tests whether snapshot name is an LTS within
20+ # the half-open version interval [start, end).
21+ ltsInRange = start: end: name: let
22+ components = splitString "-" name;
23+ version = concatStringsSep "-" (drop 1 components);
25+ assert length components >= 2;
26+ head components == "lts"
27+ && versionAtLeast version start
28+ && versionOlder version end;
30+ # A function to get pkg-def-extras with build fixes for certain
34+ # Work around a mismatch between stackage metadata and the
35+ # libraries shipped with GHC.
36+ # https://github.com/commercialhaskell/stackage/issues/4466
37+ fix-ghc-transformers = {
38+ predicate = ltsInRange "12" "14";
41+ "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
42+ "process" = (((hackage.process)."1.6.5.0").revisions).default;
47+ # Add hsc2hs to the snapshot. This is a build tool for many
48+ # packages. Stackage does not include it in the snapshots
49+ # because it is expected that hsc2hs comes with ghc.
53+ "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
59+ applyFix = name: fix: optional ((fix.predicate or (const true)) name) fix.extra;
62+ name: concatLists (mapAttrsToList (_: applyFix name) fixes);
65+ mapAttrs mkSnapshot stackage