summary refs log tree commit diff
path: root/pkgs/top-level/haskell-defaults.nix
blob: 69c99db89a2f558231b88ba0c1e327d9a5ef00d3 (plain) (blame)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# Haskell / GHC infrastructure in Nixpkgs
#
# In this file, we
#
#    * define sets of default package versions for each GHC compiler version,
#    * associate GHC versions with bootstrap compiler versions and package defaults.
#
# The actual Haskell packages are composed in haskell-packages.nix. There is
# more documentation in there.

{ makeOverridable, lowPrio, stdenv, pkgs, newScope, config, callPackage } : rec {

  # Preferences functions.
  #
  # Change these if you want to change the default versions of packages being used
  # for a particular GHC version.

  ghcHEADPrefs =
    self : self.haskellPlatformArgs_future self // {
      haskellPlatform = null;
      binary = null; # now a core package
      extensibleExceptions = self.extensibleExceptions_0_1_1_4;
    };

  ghc742Prefs =
    self : self.haskellPlatformArgs_2012_4_0_0 self // {
      haskellPlatform = self.haskellPlatform_2012_4_0_0;
      binary = null; # now a core package
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; };
    };

  ghc741Prefs =
    self : self.haskellPlatformArgs_2012_2_0_0 self // {
      haskellPlatform = self.haskellPlatform_2012_2_0_0;
      binary = null; # now a core package
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; };
    };

  ghc722Prefs =
    self : self.haskellPlatformArgs_2012_2_0_0 self // {
      haskellPlatform = self.haskellPlatform_2012_2_0_0;
      binary = null; # a core package
      deepseq = self.deepseq_1_3_0_1;
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; };
    };

  ghc721Prefs = ghc722Prefs;

  ghc704Prefs =
    self : self.haskellPlatformArgs_2011_4_0_0 self // {
      haskellPlatform = self.haskellPlatform_2011_4_0_0;
      cabalInstall_0_14_0 = self.cabalInstall_0_14_0.override { Cabal = self.Cabal_1_14_0; };
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; };
      monadPar = self.monadPar_0_1_0_3;
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
    };

  ghc703Prefs =
    self : self.haskellPlatformArgs_2011_2_0_1 self // {
      haskellPlatform = self.haskellPlatform_2011_2_0_1;
      cabalInstall_0_14_0 = self.cabalInstall_0_14_0.override { Cabal = self.Cabal_1_14_0; zlib = self.zlib_0_5_3_3; };
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; zlib = self.zlib_0_5_3_3; };
      monadPar = self.monadPar_0_1_0_3;
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
    };

  ghc702Prefs = ghc701Prefs;

  ghc701Prefs =
    self : self.haskellPlatformArgs_2011_2_0_0 self // {
      haskellPlatform = self.haskellPlatform_2011_2_0_0;
      cabalInstall_0_14_0 = self.cabalInstall_0_14_0.override { Cabal = self.Cabal_1_14_0; zlib = self.zlib_0_5_3_3; };
      cabalInstall_1_16_0_2 = self.cabalInstall_1_16_0_2.override { Cabal = self.Cabal_1_16_0_3; zlib = self.zlib_0_5_3_3; };
      monadPar = self.monadPar_0_1_0_3;
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
    };

  ghc6123Prefs = ghc6122Prefs;

  ghc6122Prefs =
    self : self.haskellPlatformArgs_2010_2_0_0 self // {
      haskellPlatform = self.haskellPlatform_2010_2_0_0;
      mtl1 = self.mtl_1_1_0_2;
      monadPar = self.monadPar_0_1_0_3;
      deepseq = self.deepseq_1_1_0_2;
      # deviating from Haskell platform here, to make some packages (notably statistics) compile
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
    };

  ghc6121Prefs =
    self : self.haskellPlatformArgs_2010_1_0_0 self // {
      haskellPlatform = self.haskellPlatform_2010_1_0_0;
      mtl1 = self.mtl_1_1_0_2;
      extensibleExceptions = self.extensibleExceptions_0_1_1_0;
      deepseq = self.deepseq_1_1_0_2;
      monadPar = self.monadPar_0_1_0_3;
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
      # deviating from Haskell platform here, to make some packages (notably statistics) compile
    };

  ghc6104Prefs =
    self : self.haskellPlatformArgs_2009_2_0_2 self // {
      haskellPlatform = self.haskellPlatform_2009_2_0_2;
      mtl = self.mtl_1_1_0_2;
      mtl1 = self.mtl_1_1_0_2;
      extensibleExceptions = self.extensibleExceptions_0_1_1_0;
      text = self.text_0_11_0_6;
      deepseq = self.deepseq_1_1_0_2;
      monadPar = self.monadPar_0_1_0_3;
      jailbreakCabal = self.jailbreakCabal.override { Cabal = self.Cabal_1_14_0; };
      # deviating from Haskell platform here, to make some packages (notably statistics) compile
    };

  # Abstraction for Haskell packages collections
  packagesFun = makeOverridable
   ({ ghcPath
    , ghcBinary ? ghc6101Binary
    , prefFun
    , extraPrefs ? (x : {})
    , profExplicit ? false, profDefault ? false
    , modifyPrio ? lowPrio
    } :
      import ./haskell-packages.nix {
        inherit pkgs newScope modifyPrio;
        prefFun = self : super : self // prefFun super // extraPrefs super;
        # prefFun = self : super : self;
        enableLibraryProfiling =
          if profExplicit then profDefault
                          else config.cabal.libraryProfiling or profDefault;
        ghc = callPackage ghcPath { ghc = ghcBinary; };
      });

  defaultVersionPrioFun =
    profDefault :
    if config.cabal.libraryProfiling or false == profDefault
      then (x : x)
      else lowPrio;

  packages = args : let r = packagesFun args;
                    in  r // { lowPrio     = r.override { modifyPrio   = lowPrio; };
                               highPrio    = r.override { modifyPrio   = x : x; };
                               noProfiling = r.override { profDefault  = false;
                                                          profExplicit = true;
                                                          modifyPrio   = defaultVersionPrioFun false; };
                               profiling   = r.override { profDefault  = true;
                                                          profExplicit = true;
                                                          modifyPrio   = defaultVersionPrioFun true; };
                             };

  # Binary versions of GHC
  #
  # GHC binaries are around for bootstrapping purposes

  # If we'd want to reactivate the 6.6 and 6.8 series of ghc, we'd
  # need to reenable an old binary such as this.
  /*
  ghc642Binary = lowPrio (import ../development/compilers/ghc/6.4.2-binary.nix {
    inherit fetchurl stdenv ncurses gmp;
    readline = if stdenv.system == "i686-linux" then readline4 else readline5;
    perl = perl58;
  });
  */

  ghc6101Binary = lowPrio (callPackage ../development/compilers/ghc/6.10.1-binary.nix {
    gmp = pkgs.gmp4;
  });

  ghc6102Binary = lowPrio (callPackage ../development/compilers/ghc/6.10.2-binary.nix {
    gmp = pkgs.gmp4;
  });

  ghc6121Binary = lowPrio (callPackage ../development/compilers/ghc/6.12.1-binary.nix {
    gmp = pkgs.gmp4;
  });

  ghc704Binary = lowPrio (callPackage ../development/compilers/ghc/7.0.4-binary.nix {
    gmp = pkgs.gmp4;
  });

  ghc742Binary = lowPrio (callPackage ../development/compilers/ghc/7.4.2-binary.nix {
    gmp = pkgs.gmp4;
  });

  ghc6101BinaryDarwin = if stdenv.isDarwin then ghc704Binary else ghc6101Binary;
  ghc6121BinaryDarwin = if stdenv.isDarwin then ghc704Binary else ghc6121Binary;

  # Compiler configurations
  #
  # Here, we associate compiler versions with bootstrap compiler versions and
  # preference functions.

  packages_ghc6104 =
    packages { ghcPath = ../development/compilers/ghc/6.10.4.nix;
               prefFun = ghc6104Prefs;
             };

  packages_ghc6121 =
    packages { ghcPath =  ../development/compilers/ghc/6.12.1.nix;
               prefFun = ghc6121Prefs;
             };

  packages_ghc6122 =
    packages { ghcPath = ../development/compilers/ghc/6.12.2.nix;
               prefFun = ghc6122Prefs;
             };

  packages_ghc6123 =
    packages { ghcPath = ../development/compilers/ghc/6.12.3.nix;
               prefFun = ghc6123Prefs;
             };

  # Will never make it into a platform release, severe bugs; leave at lowPrio.
  packages_ghc701 =
    packages { ghcPath = ../development/compilers/ghc/7.0.1.nix;
               prefFun = ghc701Prefs;
             };

  packages_ghc702 =
    packages { ghcPath = ../development/compilers/ghc/7.0.2.nix;
               prefFun = ghc702Prefs;
             };

  packages_ghc703 =
    packages { ghcPath = ../development/compilers/ghc/7.0.3.nix;
               prefFun = ghc703Prefs;
             };

  # The following items are a bit convoluted, but they serve the
  # following purpose:
  #   - for the default version of GHC, both profiling and
  #     non-profiling versions should be built by Hydra --
  #     therefore, the _no_profiling and _profiling calls;
  #   - however, if a user just upgrades a profile, then the
  #     cabal/libraryProfiling setting should be respected; i.e.,
  #     the versions not matching the profiling config setting
  #     should have low priority -- therefore, the use of
  #     defaultVersionPrioFun;
  #   - it should be possible to select library versions that
  #     respect the config setting using the standard
  #     packages_ghc704 path -- therefore, the additional
  #     call in packages_ghc704, without recurseIntoAttrs,
  #     so that Hydra doesn't build these.

  packages_ghc704 =
    packages { ghcPath = ../development/compilers/ghc/7.0.4.nix;
               ghcBinary = ghc6101BinaryDarwin;
               prefFun = ghc704Prefs;
             };

  packages_ghc721 =
    packages { ghcPath = ../development/compilers/ghc/7.2.1.nix;
               ghcBinary = ghc6121BinaryDarwin;
               prefFun = ghc721Prefs;
             };

  packages_ghc722 =
    packages { ghcPath = ../development/compilers/ghc/7.2.2.nix;
               ghcBinary = ghc6121BinaryDarwin;
               prefFun = ghc722Prefs;
             };

  packages_ghc741 =
    packages { ghcPath = ../development/compilers/ghc/7.4.1.nix;
               ghcBinary = ghc6121BinaryDarwin;
               prefFun = ghc741Prefs;
             };

  packages_ghc742 =
    packages { ghcPath = ../development/compilers/ghc/7.4.2.nix;
               ghcBinary = ghc6121BinaryDarwin;
               prefFun = ghc742Prefs;
             };

  packages_ghc761 =
    packages { ghcPath = ../development/compilers/ghc/7.6.1.nix;
               ghcBinary = ghc704Binary;
               prefFun = ghcHEADPrefs;
             };

  # Reasonably current HEAD snapshot. Should *always* be lowPrio.
  packages_ghcHEAD =
    packages { ghcPath = ../development/compilers/ghc/head.nix;
               ghcBinary = ghc742Binary;
               prefFun = ghcHEADPrefs;
             };

}