fix #269. Apply fix to mkStackPkgSet (#310)

First fix only fixed `haskell-nix.snapshot` by applying the fix also
to mkStackPkgSet stack.yaml based projects should work with lts 14
This commit is contained in:
Hamish Mackenzie 2019-11-09 17:01:04 +13:00 committed by GitHub
parent 6b7ac2ca4d
commit 023863aeca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 16 deletions

View File

@ -76,6 +76,18 @@ self: super: {
inherit hackage pkg-def;
});
# Some boot packages (libiserv) are in lts, but not in hackage,
# so we should not try to get it from hackage based on the stackage
# info. Instead we can add ghc-boot-packages to `pkg-def-extras`.
excludeBootPackages = pkg-def: hackage:
let original = pkg-def hackage;
bootPkgNames = self.lib.attrNames
self.ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
in original // {
packages = self.lib.filterAttrs (n: _: self.lib.all (b: n != b) bootPkgNames)
original.packages;
};
# Create a Haskell package set based on a Stack configuration.
mkStackPkgSet =
{ stack-pkgs # Path to the output of stack-to-nix
@ -92,7 +104,7 @@ self: super: {
compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
patchesModule = ghcHackagePatches.${compiler.nix-name} or {};
in mkPkgSet {
inherit pkg-def;
pkg-def = excludeBootPackages pkg-def;
pkg-def-extras = [ stack-pkgs.extras
self.ghc-boot-packages.${compiler.nix-name}
]
@ -130,7 +142,7 @@ self: super: {
};
# Package sets for all stackage snapshots.
snapshots = import ../snapshots.nix { inherit (self) lib ghc-boot-packages; inherit mkPkgSet stackage; };
snapshots = import ../snapshots.nix { inherit (self) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
# Pick a recent LTS snapshot to be our "default" package set.
haskellPackages = snapshots."lts-14.13";

View File

@ -6,23 +6,13 @@
# A particular package in a snapshot would be accessed with:
# snapshots."lts-13.18".conduit
{ lib, mkPkgSet, stackage, ghc-boot-packages }:
{ lib, mkPkgSet, stackage, excludeBootPackages, ghc-boot-packages }:
with lib;
let
mkSnapshot = name: pkg-def: (let pkgSet = mkPkgSet {
# Some boot packages (libiserv) are in lts, but not in hackage,
# so we should not try to get it from hackage based on the stackage
# info. Instead we can add ghc-boot-packages to `pkg-def-extras`.
pkg-def = hackage:
let original = pkg-def hackage;
bootPkgNames = lib.attrNames
ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
in original // {
packages = lib.filterAttrs (n: _: lib.all (b: n != b) bootPkgNames)
original.packages;
};
pkg-def = excludeBootPackages pkg-def;
# ghc-boot-packages are needed for the reinstallable ghc library and
# are constructed from the patched ghc source.
pkg-def-extras = (pkg-def-extras name)

View File

@ -7,6 +7,6 @@
stack-simple = ./stack-simple.nix;
};
};
resolver = "lts-13.26";
resolver = "lts-14.13";
modules = [ ({ lib, ... }: { packages = {}; }) { packages = {}; } ];
}

View File

@ -17,7 +17,7 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-13.26
resolver: lts-14.13
# User packages to be built.
# Various formats can be used as shown in the example below.