on iko/ghcjs-patch-master help sign in
Externalize error msg functions (#588)
d47ae23Jean-Baptiste Giraudeau
modules/component-driver.nix+3−4
@@ -74,10 +74,9 @@ in
74 };
74 };
75
75
76 config.bootPkgs = [
76 config.bootPkgs = [
77− "rts" "ghc-boot-th"
77+ "rts" "ghc-boot-th"
78− "ghc-heap" # since ghc 8.6.
78+ "ghc-heap" # since ghc 8.6.
79− ]
80− ++ lib.optional (!config.reinstallableLibGhc) "ghc";
79+ ] ++ lib.optional (!config.reinstallableLibGhc) "ghc";
81
80
82 options.hsPkgs = lib.mkOption {
81 options.hsPkgs = lib.mkOption {
83 type = lib.types.unspecified;
82 type = lib.types.unspecified;
modules/error-handler.nixnew file+41
@@ -0,0 +1,41 @@
1+{ lib, config, ... }:
2+{
3+ options.errorHandler = lib.mkOption {
4+ type = lib.types.unspecified;
5+ };
6+
7+ config.errorHandler = {
8+ buildDepError = pkg:
9+ builtins.throw ''
10+ The Haskell package set does not contain the package: ${pkg} (build dependency).
11+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
12+ '';
13+ sysDepError = pkg:
14+ builtins.throw ''
15+ The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
16+ You may need to augment the system package mapping in haskell.nix so that it can be found.
17+ '';
18+ pkgConfDepError = pkg:
19+ builtins.throw ''
20+ The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
21+ You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
22+ '';
23+ exeDepError = pkg:
24+ builtins.throw ''
25+ The local executable components do not include the component: ${pkg} (executable dependency).
26+ '';
27+ legacyExeDepError = pkg:
28+ builtins.throw ''
29+ The Haskell package set does not contain the package: ${pkg} (executable dependency).
30+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
31+ '';
32+ buildToolDepError = pkg:
33+ builtins.throw ''
34+ Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
35+ If this is a system dependency:
36+ You may need to augment the system package mapping in haskell.nix so that it can be found.
37+ If this is a Haskell dependency:
38+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39+ '';
40+ };
41+}
package-set.nix+3
@@ -83,6 +83,9 @@ in pkgs.lib.evalModules {
83
83
84 })
84 })
85
85
86+ # Error handlers
87+ ./modules/error-handler.nix
88+
86 # Supplies metadata
89 # Supplies metadata
87 ./modules/cabal.nix
90 ./modules/cabal.nix
88
91