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 null 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.alex.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
23 { packages.happy.package.setup-depends = [pkgSet.config.hsPkgs.Cabal]; }
24 ] ++ optional (ltsInRange "1" "15" name) {
25 packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ];
27 }; in pkgSet).config.hsPkgs;
29 # Tests whether snapshot name is an LTS within
30 # the half-open version interval [start, end).
31 ltsInRange = start: end: name: let
32 components = splitString "-" name;
33 version = concatStringsSep "-" (drop 1 components);
35 assert length components >= 2;
36 head components == "lts"
37 && versionAtLeast version start
38 && versionOlder version end;
40 # A function to get pkg-def-extras with build fixes for certain
44 # Work around a mismatch between stackage metadata and the
45 # libraries shipped with GHC.
46 # https://github.com/commercialhaskell/stackage/issues/4466
47 fix-ghc-transformers = {
48 predicate = ltsInRange "12" "14"; # [12, 14) : 14.1 has correct versions
51 "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
52 "process" = (((hackage.process)."1.6.5.0").revisions).default;
57 # Add hsc2hs to the snapshot. This is a build tool for many
58 # packages. Stackage does not include it in the snapshots
59 # because it is expected that hsc2hs comes with ghc.
61 predicate = ltsInRange "1" "14"; # [1, 14) : 14.1 includes hsc2hs
64 "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
70 applyFix = name: fix: optional ((fix.predicate or (const true)) name) fix.extra;
73 name: concatLists (mapAttrsToList (_: applyFix name) fixes);
76 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