on iko/ghcjs-patch-master help sign in
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

commit023863aeca4db7acbc4cd2e4c5e675ac732a8780 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateSat 9 Nov 2019, 17:01 (7 years ago) parent6b7ac2c
4 files changed+18−16
overlays/haskell.nix+14−2 snapshots.nix+2−12 test/stack-simple/pkgs.nix+1−1 test/stack-simple/stack.yaml+1−1
overlays/haskell.nix+14−2
@@ -76,6 +76,18 @@ self: super: {
7676 inherit hackage pkg-def;
7777 });
7878
79+ # Some boot packages (libiserv) are in lts, but not in hackage,
80+ # so we should not try to get it from hackage based on the stackage
81+ # info. Instead we can add ghc-boot-packages to `pkg-def-extras`.
82+ excludeBootPackages = pkg-def: hackage:
83+ let original = pkg-def hackage;
84+ bootPkgNames = self.lib.attrNames
85+ self.ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
86+ in original // {
87+ packages = self.lib.filterAttrs (n: _: self.lib.all (b: n != b) bootPkgNames)
88+ original.packages;
89+ };
90+
7991 # Create a Haskell package set based on a Stack configuration.
8092 mkStackPkgSet =
8193 { stack-pkgs # Path to the output of stack-to-nix
@@ -92,7 +104,7 @@ self: super: {
92104 compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
93105 patchesModule = ghcHackagePatches.${compiler.nix-name} or {};
94106 in mkPkgSet {
95− inherit pkg-def;
107+ pkg-def = excludeBootPackages pkg-def;
96108 pkg-def-extras = [ stack-pkgs.extras
97109 self.ghc-boot-packages.${compiler.nix-name}
98110 ]
@@ -130,7 +142,7 @@ self: super: {
130142 };
131143
132144 # Package sets for all stackage snapshots.
133− snapshots = import ../snapshots.nix { inherit (self) lib ghc-boot-packages; inherit mkPkgSet stackage; };
145+ snapshots = import ../snapshots.nix { inherit (self) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
134146 # Pick a recent LTS snapshot to be our "default" package set.
135147 haskellPackages = snapshots."lts-14.13";
136148
snapshots.nix+2−12
@@ -6,23 +6,13 @@
66# A particular package in a snapshot would be accessed with:
77# snapshots."lts-13.18".conduit
88
9−{ lib, mkPkgSet, stackage, ghc-boot-packages }:
9+{ lib, mkPkgSet, stackage, excludeBootPackages, ghc-boot-packages }:
1010
1111with lib;
1212
1313let
1414 mkSnapshot = name: pkg-def: (let pkgSet = mkPkgSet {
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`.
18− pkg-def = hackage:
19− let original = pkg-def hackage;
20− bootPkgNames = lib.attrNames
21− ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
22− in original // {
23− packages = lib.filterAttrs (n: _: lib.all (b: n != b) bootPkgNames)
24− original.packages;
25− };
15+ pkg-def = excludeBootPackages pkg-def;
2616 # ghc-boot-packages are needed for the reinstallable ghc library and
2717 # are constructed from the patched ghc source.
2818 pkg-def-extras = (pkg-def-extras name)
test/stack-simple/pkgs.nix+1−1
@@ -7,6 +7,6 @@
77 stack-simple = ./stack-simple.nix;
88 };
99 };
10− resolver = "lts-13.26";
10+ resolver = "lts-14.13";
1111 modules = [ ({ lib, ... }: { packages = {}; }) { packages = {}; } ];
1212 }
test/stack-simple/stack.yaml+1−1
@@ -17,7 +17,7 @@
1717#
1818# resolver: ./custom-snapshot.yaml
1919# resolver: https://example.com/snapshots/2018-01-01.yaml
20−resolver: lts-13.26
20+resolver: lts-14.13
2121
2222# User packages to be built.
2323# Various formats can be used as shown in the example below.