forked from haskell/haskell-ide-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cabal-helper.nix
175 lines (169 loc) · 10.3 KB
/
cabal-helper.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
let
buildDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (build dependency).
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.
'';
sysDepError = pkg:
builtins.throw ''
The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
You may need to augment the system package mapping in haskell.nix so that it can be found.
'';
pkgConfDepError = pkg:
builtins.throw ''
The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
'';
exeDepError = pkg:
builtins.throw ''
The local executable components do not include the component: ${pkg} (executable dependency).
'';
legacyExeDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (executable dependency).
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.
'';
buildToolDepError = pkg:
builtins.throw ''
Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
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.
'';
in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = { dev = false; };
package = {
specVersion = "2.0";
identifier = { name = "cabal-helper"; version = "0.9.0.0"; };
license = "AGPL-3.0-only";
copyright = "";
maintainer = "[email protected]";
author = "Daniel Gröber <[email protected]>";
homepage = "";
url = "";
synopsis = "Simple interface to some of Cabal's configuration state, mainly used by ghc-mod";
description = "Cabal's little helper provides access to build information gathered by\n@cabal@ when configuring a project. Specifically we're interested in\nretrieving enough information to bring up a compiler session, using the GHC\nAPI, which is similar to running @cabal repl@ in a project.\n\nWhile simple in principle this is complicated by the fact that the\ninformation Cabal writes to disk is in an unstable format and only really\naccessible through the Cabal API itself.\n\nSince we do not want to bind the user of a development tool which utilises\nthis library to a specific version of Cabal we compile the code which\ninterfaces with the Cabal library's API on the user's machine, at runtime,\nagainst whichever version of Cabal was used to write the on disk information\nfor a given project.\n\nIf this version of Cabal is not available on the users machine anymore,\nwhich is fairly likely since cabal-install is usually linked statically, we\nhave support for compiling the Cabal library also. In this case the library\nis installed into a private, isolated, package database in\n@\$XDG_CACHE_HOME/cabal-helper@ so as to not interfere with the user's\npackage database.";
buildType = "Custom";
isLocal = true;
setup-depends = [
(hsPkgs.buildPackages.base or (pkgs.buildPackages.base or (buildToolDepError "base")))
(hsPkgs.buildPackages.Cabal or (pkgs.buildPackages.Cabal or (buildToolDepError "Cabal")))
];
};
components = {
"library" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."Cabal" or (buildDepError "Cabal"))
(hsPkgs."cabal-plan" or (buildDepError "cabal-plan"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."directory" or (buildDepError "directory"))
(hsPkgs."filepath" or (buildDepError "filepath"))
(hsPkgs."transformers" or (buildDepError "transformers"))
(hsPkgs."mtl" or (buildDepError "mtl"))
(hsPkgs."process" or (buildDepError "process"))
(hsPkgs."unix-compat" or (buildDepError "unix-compat"))
(hsPkgs."semigroupoids" or (buildDepError "semigroupoids"))
] ++ (pkgs.lib).optional (!system.isWindows) (hsPkgs."unix" or (buildDepError "unix"));
buildable = true;
};
exes = {
"cabal-helper-wrapper" = {
depends = ([
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."Cabal" or (buildDepError "Cabal"))
(hsPkgs."cabal-plan" or (buildDepError "cabal-plan"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."bytestring" or (buildDepError "bytestring"))
(hsPkgs."directory" or (buildDepError "directory"))
(hsPkgs."filepath" or (buildDepError "filepath"))
(hsPkgs."mtl" or (buildDepError "mtl"))
(hsPkgs."process" or (buildDepError "process"))
(hsPkgs."pretty-show" or (buildDepError "pretty-show"))
(hsPkgs."text" or (buildDepError "text"))
(hsPkgs."template-haskell" or (buildDepError "template-haskell"))
(hsPkgs."temporary" or (buildDepError "temporary"))
(hsPkgs."transformers" or (buildDepError "transformers"))
(hsPkgs."unix-compat" or (buildDepError "unix-compat"))
(hsPkgs."utf8-string" or (buildDepError "utf8-string"))
] ++ (pkgs.lib).optional (system.isWindows) (hsPkgs."base" or (buildDepError "base"))) ++ (pkgs.lib).optional (!system.isWindows) (hsPkgs."unix" or (buildDepError "unix"));
build-tools = [
(hsPkgs.buildPackages.cabal-install or (pkgs.buildPackages.cabal-install or (buildToolDepError "cabal-install")))
(hsPkgs.buildPackages.cabal or (pkgs.buildPackages.cabal or (buildToolDepError "cabal")))
];
buildable = true;
};
"cabal-helper-main" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."Cabal" or (buildDepError "Cabal"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."bytestring" or (buildDepError "bytestring"))
(hsPkgs."filepath" or (buildDepError "filepath"))
(hsPkgs."directory" or (buildDepError "directory"))
(hsPkgs."ghc-prim" or (buildDepError "ghc-prim"))
];
buildable = if flags.dev then true else false;
};
};
tests = {
"compile-test" = {
depends = ([
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."Cabal" or (buildDepError "Cabal"))
(hsPkgs."cabal-plan" or (buildDepError "cabal-plan"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."bytestring" or (buildDepError "bytestring"))
(hsPkgs."directory" or (buildDepError "directory"))
(hsPkgs."filepath" or (buildDepError "filepath"))
(hsPkgs."mtl" or (buildDepError "mtl"))
(hsPkgs."process" or (buildDepError "process"))
(hsPkgs."pretty-show" or (buildDepError "pretty-show"))
(hsPkgs."text" or (buildDepError "text"))
(hsPkgs."template-haskell" or (buildDepError "template-haskell"))
(hsPkgs."temporary" or (buildDepError "temporary"))
(hsPkgs."transformers" or (buildDepError "transformers"))
(hsPkgs."unix-compat" or (buildDepError "unix-compat"))
(hsPkgs."utf8-string" or (buildDepError "utf8-string"))
] ++ (pkgs.lib).optional (system.isWindows) (hsPkgs."base" or (buildDepError "base"))) ++ (pkgs.lib).optional (!system.isWindows) (hsPkgs."unix" or (buildDepError "unix"));
build-tools = [
(hsPkgs.buildPackages.cabal-install or (pkgs.buildPackages.cabal-install or (buildToolDepError "cabal-install")))
(hsPkgs.buildPackages.cabal or (pkgs.buildPackages.cabal or (buildToolDepError "cabal")))
(hsPkgs.buildPackages.cabal or (pkgs.buildPackages.cabal or (buildToolDepError "cabal")))
];
buildable = true;
};
"ghc-session" = {
depends = ([
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."ghc" or (buildDepError "ghc"))
(hsPkgs."ghc-paths" or (buildDepError "ghc-paths"))
(hsPkgs."cabal-helper" or (buildDepError "cabal-helper"))
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."Cabal" or (buildDepError "Cabal"))
(hsPkgs."cabal-plan" or (buildDepError "cabal-plan"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."bytestring" or (buildDepError "bytestring"))
(hsPkgs."directory" or (buildDepError "directory"))
(hsPkgs."filepath" or (buildDepError "filepath"))
(hsPkgs."mtl" or (buildDepError "mtl"))
(hsPkgs."process" or (buildDepError "process"))
(hsPkgs."pretty-show" or (buildDepError "pretty-show"))
(hsPkgs."text" or (buildDepError "text"))
(hsPkgs."template-haskell" or (buildDepError "template-haskell"))
(hsPkgs."temporary" or (buildDepError "temporary"))
(hsPkgs."transformers" or (buildDepError "transformers"))
(hsPkgs."unix-compat" or (buildDepError "unix-compat"))
(hsPkgs."utf8-string" or (buildDepError "utf8-string"))
] ++ (pkgs.lib).optional (system.isWindows) (hsPkgs."base" or (buildDepError "base"))) ++ (pkgs.lib).optional (!system.isWindows) (hsPkgs."unix" or (buildDepError "unix"));
build-tools = [
(hsPkgs.buildPackages.cabal-install or (pkgs.buildPackages.cabal-install or (buildToolDepError "cabal-install")))
(hsPkgs.buildPackages.cabal or (pkgs.buildPackages.cabal or (buildToolDepError "cabal")))
];
buildable = true;
};
};
};
} // rec { src = (pkgs.lib).mkDefault ./submodules/cabal-helper; }