@@ -6,15 +6,29 @@
6# A particular package in a snapshot would be accessed with:
6# A particular package in a snapshot would be accessed with:
7# snapshots."lts-13.18".conduit
7# snapshots."lts-13.18".conduit
9−{ lib, mkPkgSet, stackage }:
9+{ lib, mkPkgSet, stackage, ghc-boot-packages }:
14 mkSnapshot = name: pkg-def: (let pkgSet = mkPkgSet {
14 mkSnapshot = name: pkg-def: (let pkgSet = mkPkgSet {
15− inherit pkg-def;
15+ # Some boot packages (libiserv) are in lts, but not in hackage,
16+ # so we should not try to get it from hackage based on the stackage
17+ # info. Instead we can add ghc-boot-packages to `pkg-def-extras`.
19+ let original = pkg-def hackage;
20+ bootPkgNames = lib.attrNames
21+ ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
23+ packages = lib.filterAttrs (n: _: lib.all (b: n != b) bootPkgNames)
26+ # ghc-boot-packages are needed for the reinstallable ghc library and
27+ # are constructed from the patched ghc source.
16− pkg-def-extras = pkg-def-extras name;
28+ pkg-def-extras = (pkg-def-extras name)
29+ ++ [(hackage: ghc-boot-packages.${(pkg-def hackage).compiler.nix-name})];
17 modules = [
30 modules = [
31+ { reinstallableLibGhc = true; } # Allow ghc library to be installed for packages that need it
18 { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
32 { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
19 { packages.alex.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
33 { packages.alex.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
20 { packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
34 { packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
@@ -40,7 +54,7 @@ let
40 # libraries shipped with GHC.
54 # libraries shipped with GHC.
41 # https://github.com/commercialhaskell/stackage/issues/4466
55 # https://github.com/commercialhaskell/stackage/issues/4466
42 fix-ghc-transformers = {
56 fix-ghc-transformers = {
43− predicate = ltsInRange "12" "14";
57+ predicate = ltsInRange "12" "14"; # [12, 14) : 14.1 has correct versions
44 extra = hackage: {
58 extra = hackage: {
45 packages = {
59 packages = {
46 "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
60 "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
@@ -53,6 +67,7 @@ let
53 # packages. Stackage does not include it in the snapshots
67 # packages. Stackage does not include it in the snapshots
54 # because it is expected that hsc2hs comes with ghc.
68 # because it is expected that hsc2hs comes with ghc.
55 fix-hsc2hs = {
69 fix-hsc2hs = {
70+ predicate = ltsInRange "1" "14"; # [1, 14) : 14.1 includes hsc2hs
56 extra = hackage: {
71 extra = hackage: {
57 packages = {
72 packages = {
58 "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
73 "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;