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, excludeBootPackages, ghc-boot-packages }:
14 mkSnapshot = name: pkg-def: (let pkgSet = mkPkgSet {
15 pkg-def = excludeBootPackages pkg-def;
16 # ghc-boot-packages are needed for the reinstallable ghc library and
17 # are constructed from the patched ghc source.
18 pkg-def-extras = (pkg-def-extras name)
19 ++ [(hackage: ghc-boot-packages.${(pkg-def hackage).compiler.nix-name})];
21 { reinstallableLibGhc = true; } # Allow ghc library to be installed for packages that need it
22 { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
23 { packages.alex.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
24 { packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
26 }; in pkgSet).config.hsPkgs;
28 # Tests whether snapshot name is an LTS within
29 # the half-open version interval [start, end).
30 ltsInRange = start: end: name: let
31 components = splitString "-" name;
32 version = concatStringsSep "-" (drop 1 components);
34 assert length components >= 2;
35 head components == "lts"
36 && versionAtLeast version start
37 && versionOlder version end;
39 # A function to get pkg-def-extras with build fixes for certain
43 # Work around a mismatch between stackage metadata and the
44 # libraries shipped with GHC.
45 # https://github.com/commercialhaskell/stackage/issues/4466
46 fix-ghc-transformers = {
47 predicate = ltsInRange "12" "14"; # [12, 14) : 14.1 has correct versions
50 "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
51 "process" = (((hackage.process)."1.6.5.0").revisions).default;
56 # Add hsc2hs to the snapshot. This is a build tool for many
57 # packages. Stackage does not include it in the snapshots
58 # because it is expected that hsc2hs comes with ghc.
60 predicate = ltsInRange "1" "14"; # [1, 14) : 14.1 includes hsc2hs
63 "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
69 applyFix = name: fix: optional ((fix.predicate or (const true)) name) fix.extra;
72 name: concatLists (mapAttrsToList (_: applyFix name) fixes);
75 mapAttrs mkSnapshot stackage
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list