1/*
2 This is the Hydra jobset for the `haskell-updates` branch in Nixpkgs.
3 You can see the status of this jobset at
4 https://hydra.nixos.org/jobset/nixpkgs/haskell-updates.
5
6 To debug this expression you can use `hydra-eval-jobs` from
7 `pkgs.hydra_unstable` which prints the jobset description
8 to `stdout`:
9
10 $ hydra-eval-jobs -I . pkgs/top-level/release-haskell.nix
11*/
12{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ] }:
13
14let
15
16 releaseLib = import ./release-lib.nix {
17 inherit supportedSystems;
18 };
19
20 inherit (releaseLib)
21 lib
22 mapTestOn
23 packagePlatforms
24 pkgs
25 ;
26
27 # Helper function which traverses a (nested) set
28 # of derivations produced by mapTestOn and flattens
29 # it to a list of derivations suitable to be passed
30 # to `releaseTools.aggregate` as constituents.
31 # Removes all non derivations from the input jobList.
32 #
33 # accumulateDerivations :: [ Either Derivation AttrSet ] -> [ Derivation ]
34 #
35 # > accumulateDerivations [ drv1 "string" { foo = drv2; bar = { baz = drv3; }; } ]
36 # [ drv1 drv2 drv3 ]
37 accumulateDerivations = jobList:
38 lib.concatMap (
39 attrs:
40 if lib.isDerivation attrs
41 then [ attrs ]
42 else if lib.isAttrs attrs
43 then accumulateDerivations (lib.attrValues attrs)
44 else []
45 ) jobList;
46
47 # names of all subsets of `pkgs.haskell.packages`
48 compilerNames = lib.mapAttrs (name: _: name) pkgs.haskell.packages;
49
50 # list of all compilers to test specific packages on
51 released = with compilerNames; [
52 ghc884
53 ghc8107
54 ghc902
55 ghc924
56 ];
57
58 # packagePlatforms applied to `haskell.packages.*`
59 compilerPlatforms = lib.mapAttrs
60 (_: v: packagePlatforms v)
61 pkgs.haskell.packages;
62
63 # This function lets you specify specific packages
64 # which are to be tested on a list of specific GHC
65 # versions and returns a job set for all specified
66 # combinations. See `jobs` below for an example.
67 versionedCompilerJobs = config: mapTestOn {
68 haskell.packages =
69 (lib.mapAttrs (
70 ghc: jobs:
71 lib.filterAttrs (
72 jobName: platforms:
73 lib.elem ghc (config."${jobName}" or [])
74 ) jobs
75 ) compilerPlatforms);
76 };
77
78 # hydra jobs for `pkgs` of which we import a subset of
79 pkgsPlatforms = packagePlatforms pkgs;
80
81 # names of packages in an attribute set that are maintained
82 maintainedPkgNames = set: builtins.attrNames
83 (lib.filterAttrs (
84 _: v: builtins.length (v.meta.maintainers or []) > 0
85 ) set);
86
87 recursiveUpdateMany = builtins.foldl' lib.recursiveUpdate {};
88
89 # Remove multiple elements from a list at once.
90 #
91 # removeMany
92 # :: [a] -- list of elements to remove
93 # -> [a] -- list of elements from which to remove
94 # -> [a]
95 #
96 # > removeMany ["aarch64-linux" "x86_64-darwin"] ["aarch64-linux" "x86_64-darwin" "x86_64-linux"]
97 # ["x86_64-linux"]
98 removeMany = itemsToRemove: list: lib.foldr lib.remove list itemsToRemove;
99
100 # Recursively remove platforms from the values in an attribute set.
101 #
102 # removePlatforms
103 # :: [String]
104 # -> AttrSet
105 # -> AttrSet
106 #
107 # > attrSet = {
108 # foo = ["aarch64-linux" "x86_64-darwin" "x86_64-linux"];
109 # bar.baz = ["aarch64-linux" "x86_64-linux"];
110 # bar.quux = ["aarch64-linux" "x86_64-darwin"];
111 # }
112 # > removePlatforms ["aarch64-linux" "x86_64-darwin"] attrSet
113 # {
114 # foo = ["x86_64-linux"];
115 # bar = {
116 # baz = ["x86_64-linux"];
117 # quux = [];
118 # };
119 # }
120 removePlatforms = platformsToRemove: packageSet:
121 lib.mapAttrsRecursive
122 (_: val:
123 if lib.isList val
124 then removeMany platformsToRemove val
125 else val
126 )
127 packageSet;
128
129 jobs = recursiveUpdateMany [
130 (mapTestOn {
131 haskellPackages = packagePlatforms pkgs.haskellPackages;
132 haskell.compiler = packagePlatforms pkgs.haskell.compiler // (lib.genAttrs [
133 "ghcjs"
134 "ghcjs810"
135 ] (ghcjsName: {
136 # We can't build ghcjs itself, since it exceeds 3GB (Hydra's output limit) due
137 # to the size of its bundled libs. We can however save users a bit of compile
138 # time by building the bootstrap ghcjs on Hydra. For this reason, we overwrite
139 # the ghcjs attributes in haskell.compiler with a reference to the bootstrap
140 # ghcjs attribute in their bootstrap package set (exposed via passthru) which
141 # would otherwise be ignored by Hydra.
142 bootGhcjs = (packagePlatforms pkgs.haskell.compiler.${ghcjsName}.passthru).bootGhcjs;
143 }));
144
145 tests.haskell = packagePlatforms pkgs.tests.haskell;
146
147 nixosTests = {
148 inherit (packagePlatforms pkgs.nixosTests)
149 agda
150 xmonad
151 xmonad-xdg-autostart
152 ;
153 };
154
155 agdaPackages = packagePlatforms pkgs.agdaPackages;
156
157 # top-level packages that depend on haskellPackages
158 inherit (pkgsPlatforms)
159 agda
160 arion
161 bench
162 bustle
163 blucontrol
164 cabal-install
165 cabal2nix
166 cachix
167 carp
168 cedille
169 client-ip-echo
170 darcs
171 dconf2nix
172 dhall
173 dhall-bash
174 dhall-docs
175 dhall-lsp-server
176 dhall-json
177 dhall-nix
178 diagrams-builder
179 elm2nix
180 fffuu
181 futhark
182 ghcid
183 git-annex
184 git-brunch
185 gitit
186 glirc
187 hadolint
188 haskell-ci
189 haskell-language-server
190 hasura-graphql-engine
191 hci
192 hercules-ci-agent
193 hinit
194 hedgewars
195 hledger
196 hledger-check-fancyassertions
197 hledger-iadd
198 hledger-interest
199 hledger-ui
200 hledger-web
201 hlint
202 hpack
203 # hyper-haskell # depends on electron-10.4.7 which is marked as insecure
204 hyper-haskell-server-with-packages
205 icepeak
206 idris
207 ihaskell
208 jacinda
209 jl
210 koka
211 krank
212 lambdabot
213 lhs2tex
214 madlang
215 matterhorn
216 mueval
217 naproche
218 neuron-notes
219 niv
220 nix-delegate
221 nix-deploy
222 nix-diff
223 nix-linter
224 nix-output-monitor
225 nix-script
226 nix-tree
227 nixfmt
228 nota
229 nvfetcher
230 ormolu
231 pandoc
232 pakcs
233 petrinizer
234 place-cursor-at
235 pinboard-notes-backup
236 pretty-simple
237 shake
238 shellcheck
239 sourceAndTags
240 spacecookie
241 spago
242 splot
243 stack
244 stack2nix
245 stutter
246 stylish-haskell
247 taffybar
248 tamarin-prover
249 taskell
250 termonad-with-packages
251 tldr-hs
252 tweet-hs
253 update-nix-fetchgit
254 uusi
255 uqm
256 uuagc
257 vaultenv
258 wstunnel
259 xmobar
260 xmonadctl
261 xmonad-with-packages
262 yi
263 zsh-git-prompt
264 ;
265
266 # Members of the elmPackages set that are Haskell derivations
267 elmPackages = {
268 inherit (pkgsPlatforms.elmPackages)
269 elm
270 elm-format
271 elm-instrument
272 elmi-to-json
273 ;
274 };
275
276 # GHCs linked to musl.
277 pkgsMusl.haskell.compiler = lib.recursiveUpdate
278 (packagePlatforms pkgs.pkgsMusl.haskell.compiler)
279 {
280 # remove musl ghc865Binary since it is known to be broken and
281 # causes an evaluation error on darwin.
282 # TODO: remove ghc865Binary altogether and use ghc8102Binary
283 ghc865Binary = {};
284
285 ghcjs = {};
286 ghcjs810 = {};
287
288 # Can't be built with musl, see meta.broken comment in the drv
289 integer-simple.ghc884 = {};
290 };
291
292 # Get some cache going for MUSL-enabled GHC.
293 pkgsMusl.haskellPackages =
294 removePlatforms
295 [
296 # pkgsMusl is compiled natively with musl. It is not
297 # cross-compiled (unlike pkgsStatic). We can only
298 # natively bootstrap GHC with musl on x86_64-linux because
299 # upstream doesn't provide a musl bindist for aarch64.
300 "aarch64-linux"
301
302 # musl only supports linux, not darwin.
303 "x86_64-darwin"
304 ]
305 {
306 inherit (packagePlatforms pkgs.pkgsMusl.haskellPackages)
307 hello
308 lens
309 random
310 ;
311 };
312
313 # Test some statically linked packages to catch regressions
314 # and get some cache going for static compilation with GHC.
315 # Use integer-simple to avoid GMP linking problems (LGPL)
316 pkgsStatic =
317 removePlatforms
318 [
319 "aarch64-linux" # times out on Hydra
320 "x86_64-darwin" # TODO: reenable when static libiconv works on darwin
321 ] {
322 haskellPackages = {
323 inherit (packagePlatforms pkgs.pkgsStatic.haskellPackages)
324 hello
325 lens
326 random
327 QuickCheck
328 cabal2nix
329 terminfo # isn't bundled for cross
330 xhtml # isn't bundled for cross
331 ;
332 };
333
334 haskell.packages.native-bignum.ghc924 = {
335 inherit (packagePlatforms pkgs.pkgsStatic.haskell.packages.native-bignum.ghc924)
336 hello
337 lens
338 random
339 QuickCheck
340 cabal2nix
341 terminfo # isn't bundled for cross
342 xhtml # isn't bundled for cross
343 ;
344 };
345 };
346 })
347 (versionedCompilerJobs {
348 # Packages which should be checked on more than the
349 # default GHC version. This list can be used to test
350 # the state of the package set with newer compilers
351 # and to confirm that critical packages for the
352 # package sets (like Cabal, jailbreak-cabal) are
353 # working as expected.
354 cabal-install = released;
355 Cabal_3_6_3_0 = released;
356 cabal2nix = released;
357 cabal2nix-unstable = released;
358 funcmp = released;
359 haskell-language-server = released;
360 hoogle = released;
361 hlint = released;
362 hsdns = released;
363 jailbreak-cabal = released;
364 language-nix = released;
365 nix-paths = released;
366 titlecase = released;
367 ghc-api-compat = [
368 compilerNames.ghc884
369 compilerNames.ghc8107
370 compilerNames.ghc902
371 ];
372 ghc-bignum = [
373 compilerNames.ghc884
374 compilerNames.ghc8107
375 ];
376 ghc-lib = released;
377 ghc-lib-parser = released;
378 ghc-lib-parser-ex = released;
379 spectacle = [
380 compilerNames.ghc8107
381 ];
382 weeder = [
383 compilerNames.ghc8107
384 compilerNames.ghc902
385 compilerNames.ghc924
386 ];
387 purescript-cst = [
388 compilerNames.ghc8107
389 ];
390 purescript-ast = [
391 compilerNames.ghc8107
392 ];
393 })
394 {
395 mergeable = pkgs.releaseTools.aggregate {
396 name = "haskell-updates-mergeable";
397 meta = {
398 description = ''
399 Critical haskell packages that should work at all times,
400 serves as minimum requirement for an update merge
401 '';
402 maintainers = lib.teams.haskell.members;
403 };
404 constituents = accumulateDerivations [
405 # haskell specific tests
406 jobs.tests.haskell
407 # important top-level packages
408 jobs.cabal-install
409 jobs.cabal2nix
410 jobs.cachix
411 jobs.darcs
412 jobs.haskell-language-server
413 jobs.hledger
414 jobs.hledger-ui
415 jobs.hpack
416 jobs.niv
417 jobs.pandoc
418 jobs.stack
419 jobs.stylish-haskell
420 # important haskell (library) packages
421 jobs.haskellPackages.cabal-plan
422 jobs.haskellPackages.distribution-nixpkgs
423 jobs.haskellPackages.hackage-db
424 jobs.haskellPackages.xmonad
425 jobs.haskellPackages.xmonad-contrib
426 # haskell packages maintained by @peti
427 # imported from the old hydra jobset
428 jobs.haskellPackages.hopenssl
429 jobs.haskellPackages.hsemail
430 jobs.haskellPackages.hsyslog
431 ];
432 };
433 maintained = pkgs.releaseTools.aggregate {
434 name = "maintained-haskell-packages";
435 meta = {
436 description = "Aggregate jobset of all haskell packages with a maintainer";
437 maintainers = lib.teams.haskell.members;
438 };
439 constituents = accumulateDerivations
440 (builtins.map
441 (name: jobs.haskellPackages."${name}")
442 (maintainedPkgNames pkgs.haskellPackages));
443 };
444
445 muslGHCs = pkgs.releaseTools.aggregate {
446 name = "haskell-pkgsMusl-ghcs";
447 meta = {
448 description = "GHCs built with musl";
449 maintainers = with lib.maintainers; [
450 nh2
451 ];
452 };
453 constituents = accumulateDerivations [
454 jobs.pkgsMusl.haskell.compiler.ghc8102Binary
455 jobs.pkgsMusl.haskell.compiler.ghc8107Binary
456 jobs.pkgsMusl.haskell.compiler.ghc884
457 jobs.pkgsMusl.haskell.compiler.ghc8107
458 jobs.pkgsMusl.haskell.compiler.ghc902
459 jobs.pkgsMusl.haskell.compiler.ghc924
460 jobs.pkgsMusl.haskell.compiler.ghcHEAD
461 jobs.pkgsMusl.haskell.compiler.integer-simple.ghc8107
462 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc902
463 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc924
464 jobs.pkgsMusl.haskell.compiler.native-bignum.ghcHEAD
465 ];
466 };
467
468 staticHaskellPackages = pkgs.releaseTools.aggregate {
469 name = "static-haskell-packages";
470 meta = {
471 description = "Static haskell builds using the pkgsStatic infrastructure";
472 maintainers = [
473 lib.maintainers.sternenseemann
474 lib.maintainers.rnhmjoj
475 ];
476 };
477 constituents = accumulateDerivations [
478 jobs.pkgsStatic.haskellPackages
479 jobs.pkgsStatic.haskell.packages.native-bignum.ghc924
480 ];
481 };
482 }
483 ];
484
485in jobs