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" "aarch64-darwin" ] }:
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 lib.optionals (lib.isAttrs attrs) (accumulateDerivations (lib.attrValues attrs))
43 ) jobList;
44
45 # names of all subsets of `pkgs.haskell.packages`
46 #
47 # compilerNames looks like the following:
48 #
49 # ```
50 # {
51 # ghc810 = "ghc810";
52 # ghc8102Binary = "ghc8102Binary";
53 # ghc8102BinaryMinimal = "ghc8102BinaryMinimal";
54 # ghc8107 = "ghc8107";
55 # ghc924 = "ghc924";
56 # ...
57 # }
58 # ```
59 compilerNames = lib.mapAttrs (name: _: name) pkgs.haskell.packages;
60
61 # list of all compilers to test specific packages on
62 released = with compilerNames; [
63 ghc884
64 ghc8107
65 ghc902
66 ghc924
67 ghc925
68 ghc926
69 ghc927
70 ghc928
71 ghc945
72 ghc946
73 ghc962
74 ];
75
76 # packagePlatforms applied to `haskell.packages.*`
77 #
78 # This returns an attr set that looks like the following, where each Haskell
79 # package in the compiler attr set has its list of supported platforms as its
80 # value.
81 #
82 # ```
83 # {
84 # ghc810 = {
85 # conduit = [ ... ];
86 # lens = [ "i686-cygwin" "x86_64-cygwin" ... "x86_64-windows" "i686-windows" ]
87 # ...
88 # };
89 # ghc902 = { ... };
90 # ...
91 # }
92 # ```
93 compilerPlatforms = lib.mapAttrs
94 (_: v: packagePlatforms v)
95 pkgs.haskell.packages;
96
97 # This function lets you specify specific packages
98 # which are to be tested on a list of specific GHC
99 # versions and returns a job set for all specified
100 # combinations.
101 #
102 # You can call versionedCompilerJobs like the following:
103 #
104 # ```
105 # versionedCompilerJobs {
106 # ghc-tags = ["ghc902" "ghc924"];
107 # }
108 # ```
109 #
110 # This would produce an output like the following:
111 #
112 # ```
113 # {
114 # haskell.packages = {
115 # ghc884 = {};
116 # ghc810 = {};
117 # ghc902 = {
118 # ghc-tags = {
119 # aarch64-darwin = <derivation...>;
120 # aarch64-linux = <derivation...>;
121 # ...
122 # };
123 # };
124 # ghc924 = {
125 # ghc-tags = { ... };
126 # };
127 # ...
128 # };
129 # }
130 # ```
131 versionedCompilerJobs = config: mapTestOn {
132 haskell.packages =
133 let
134 # Mapping function that takes an attrset of jobs, and
135 # removes all jobs that are not specified in config.
136 #
137 # For example, imagine a call to onlyConfigJobs like:
138 #
139 # ```
140 # onlyConfigJobs
141 # "ghc902"
142 # {
143 # conduit = [ ... ];
144 # lens = [ "i686-cygwin" "x86_64-cygwin" ... "x86_64-windows" "i686-windows" ];
145 # }
146 # ```
147 #
148 # onlyConfigJobs pulls out only those jobs that are specified in config.
149 #
150 # For instance, if config is `{ lens = [ "ghc902" ]; }`, then the above
151 # example call to onlyConfigJobs will return:
152 #
153 # ```
154 # { lens = [ "i686-cygwin" "x86_64-cygwin" ... "x86_64-windows" "i686-windows" ]; }
155 # ```
156 #
157 # If config is `{ lens = [ "ghc8107" ]; }`, then the above example call
158 # to onlyConfigJobs returns `{}`.
159 #
160 # onlyConfigJobs will also remove all platforms from a job that are not
161 # supported by the GHC it is compiled with.
162 onlyConfigJobs = ghc: jobs:
163 let
164 configFilteredJobset =
165 lib.filterAttrs
166 (jobName: platforms: lib.elem ghc (config."${jobName}" or []))
167 jobs;
168
169 # Remove platforms from each job that are not supported by GHC.
170 # This is important so that we don't build jobs for platforms
171 # where GHC can't be compiled.
172 jobsetWithGHCPlatforms =
173 lib.mapAttrs
174 (_: platforms: lib.intersectLists jobs.ghc platforms)
175 configFilteredJobset;
176 in
177 jobsetWithGHCPlatforms;
178 in
179 lib.mapAttrs onlyConfigJobs compilerPlatforms;
180 };
181
182 # hydra jobs for `pkgs` of which we import a subset of
183 pkgsPlatforms = packagePlatforms pkgs;
184
185 # names of packages in an attribute set that are maintained
186 maintainedPkgNames = set: builtins.attrNames
187 (lib.filterAttrs (
188 _: v: builtins.length (v.meta.maintainers or []) > 0
189 ) set);
190
191 recursiveUpdateMany = builtins.foldl' lib.recursiveUpdate {};
192
193 # Remove multiple elements from a list at once.
194 #
195 # removeMany
196 # :: [a] -- list of elements to remove
197 # -> [a] -- list of elements from which to remove
198 # -> [a]
199 #
200 # > removeMany ["aarch64-linux" "x86_64-darwin"] ["aarch64-linux" "x86_64-darwin" "x86_64-linux"]
201 # ["x86_64-linux"]
202 removeMany = itemsToRemove: list: lib.foldr lib.remove list itemsToRemove;
203
204 # Recursively remove platforms from the values in an attribute set.
205 #
206 # removePlatforms
207 # :: [String]
208 # -> AttrSet
209 # -> AttrSet
210 #
211 # > attrSet = {
212 # foo = ["aarch64-linux" "x86_64-darwin" "x86_64-linux"];
213 # bar.baz = ["aarch64-linux" "x86_64-linux"];
214 # bar.quux = ["aarch64-linux" "x86_64-darwin"];
215 # }
216 # > removePlatforms ["aarch64-linux" "x86_64-darwin"] attrSet
217 # {
218 # foo = ["x86_64-linux"];
219 # bar = {
220 # baz = ["x86_64-linux"];
221 # quux = [];
222 # };
223 # }
224 removePlatforms = platformsToRemove: packageSet:
225 lib.mapAttrsRecursive
226 (_: val:
227 if lib.isList val
228 then removeMany platformsToRemove val
229 else val
230 )
231 packageSet;
232
233 jobs = recursiveUpdateMany [
234 (mapTestOn {
235 haskellPackages = packagePlatforms pkgs.haskellPackages;
236 haskell.compiler = packagePlatforms pkgs.haskell.compiler // (lib.genAttrs [
237 "ghcjs"
238 "ghcjs810"
239 ] (ghcjsName: {
240 # We can't build ghcjs itself, since it exceeds 3GB (Hydra's output limit) due
241 # to the size of its bundled libs. We can however save users a bit of compile
242 # time by building the bootstrap ghcjs on Hydra. For this reason, we overwrite
243 # the ghcjs attributes in haskell.compiler with a reference to the bootstrap
244 # ghcjs attribute in their bootstrap package set (exposed via passthru) which
245 # would otherwise be ignored by Hydra.
246 bootGhcjs = (packagePlatforms pkgs.haskell.compiler.${ghcjsName}.passthru).bootGhcjs;
247 }));
248
249 tests.haskell = packagePlatforms pkgs.tests.haskell;
250
251 nixosTests = {
252 inherit (packagePlatforms pkgs.nixosTests)
253 agda
254 xmonad
255 xmonad-xdg-autostart
256 ;
257 };
258
259 agdaPackages = packagePlatforms pkgs.agdaPackages;
260
261 # top-level packages that depend on haskellPackages
262 inherit (pkgsPlatforms)
263 agda
264 arion
265 bench
266 bustle
267 blucontrol
268 cabal-install
269 cabal2nix
270 cachix
271 carp
272 cedille
273 client-ip-echo
274 darcs
275 dconf2nix
276 dhall
277 dhall-bash
278 dhall-docs
279 dhall-lsp-server
280 dhall-json
281 dhall-nix
282 diagrams-builder
283 elm2nix
284 emanote
285 fffuu
286 futhark
287 ghcid
288 git-annex
289 git-brunch
290 gitit
291 glirc
292 hadolint
293 haskell-ci
294 haskell-language-server
295 hasura-graphql-engine
296 hci
297 hercules-ci-agent
298 hinit
299 hedgewars
300 hledger
301 hledger-check-fancyassertions
302 hledger-iadd
303 hledger-interest
304 hledger-ui
305 hledger-web
306 hlint
307 hpack
308 # hyper-haskell # depends on electron-10.4.7 which is marked as insecure
309 # hyper-haskell-server-with-packages # hyper-haskell-server is broken
310 icepeak
311 ihaskell
312 jacinda
313 jl
314 koka
315 krank
316 lambdabot
317 lhs2tex
318 madlang
319 mailctl
320 matterhorn
321 mueval
322 naproche
323 niv
324 nix-delegate
325 nix-deploy
326 nix-diff
327 nix-linter
328 nix-output-monitor
329 nix-script
330 nix-tree
331 nixfmt
332 nota
333 nvfetcher
334 ormolu
335 pandoc
336 petrinizer
337 place-cursor-at
338 pinboard-notes-backup
339 pretty-simple
340 shake
341 shellcheck
342 sourceAndTags
343 spacecookie
344 spago
345 splot
346 stack
347 stack2nix
348 stutter
349 stylish-haskell
350 taffybar
351 tamarin-prover
352 taskell
353 termonad
354 tldr-hs
355 tweet-hs
356 update-nix-fetchgit
357 uusi
358 uqm
359 uuagc
360 vaultenv
361 wstunnel
362 xmobar
363 xmonadctl
364 xmonad-with-packages
365 yi
366 zsh-git-prompt
367 ;
368
369 # Members of the elmPackages set that are Haskell derivations
370 elmPackages = {
371 inherit (pkgsPlatforms.elmPackages)
372 elm
373 elm-format
374 elm-instrument
375 elmi-to-json
376 ;
377 };
378
379 # GHCs linked to musl.
380 pkgsMusl.haskell.compiler = lib.recursiveUpdate
381 (packagePlatforms pkgs.pkgsMusl.haskell.compiler)
382 {
383 # remove musl ghc865Binary since it is known to be broken and
384 # causes an evaluation error on darwin.
385 # TODO: remove ghc865Binary altogether and use ghc8102Binary
386 ghc865Binary = {};
387
388 ghcjs = {};
389 ghcjs810 = {};
390
391 # Can't be built with musl, see meta.broken comment in the drv
392 integer-simple.ghc884 = {};
393 integer-simple.ghc88 = {};
394 };
395
396 # Get some cache going for MUSL-enabled GHC.
397 pkgsMusl.haskellPackages =
398 removePlatforms
399 [
400 # pkgsMusl is compiled natively with musl. It is not
401 # cross-compiled (unlike pkgsStatic). We can only
402 # natively bootstrap GHC with musl on x86_64-linux because
403 # upstream doesn't provide a musl bindist for aarch64.
404 "aarch64-linux"
405
406 # musl only supports linux, not darwin.
407 "x86_64-darwin"
408 "aarch64-darwin"
409 ]
410 {
411 inherit (packagePlatforms pkgs.pkgsMusl.haskellPackages)
412 hello
413 lens
414 random
415 ;
416 };
417
418 # Test some statically linked packages to catch regressions
419 # and get some cache going for static compilation with GHC.
420 # Use integer-simple to avoid GMP linking problems (LGPL)
421 pkgsStatic =
422 removePlatforms
423 [
424 "aarch64-linux" # times out on Hydra
425
426 # Static doesn't work on darwin
427 "x86_64-darwin"
428 "aarch64-darwin"
429 ] {
430 haskellPackages = {
431 inherit (packagePlatforms pkgs.pkgsStatic.haskellPackages)
432 hello
433 lens
434 random
435 QuickCheck
436 cabal2nix
437 terminfo # isn't bundled for cross
438 xhtml # isn't bundled for cross
439 ;
440 };
441
442 haskell.packages.native-bignum.ghc928 = {
443 inherit (packagePlatforms pkgs.pkgsStatic.haskell.packages.native-bignum.ghc928)
444 hello
445 lens
446 random
447 QuickCheck
448 cabal2nix
449 terminfo # isn't bundled for cross
450 xhtml # isn't bundled for cross
451 ;
452 };
453 };
454
455 pkgsCross.ghcjs =
456 removePlatforms
457 [
458 # Hydra output size of 3GB is exceeded
459 "aarch64-linux"
460 ]
461 {
462 haskellPackages = {
463 inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskellPackages)
464 ghc
465 hello
466 ;
467 };
468
469 haskell.packages.ghcHEAD = {
470 inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghcHEAD)
471 ghc
472 hello
473 ;
474 };
475 };
476 })
477 (versionedCompilerJobs {
478 # Packages which should be checked on more than the
479 # default GHC version. This list can be used to test
480 # the state of the package set with newer compilers
481 # and to confirm that critical packages for the
482 # package sets (like Cabal, jailbreak-cabal) are
483 # working as expected.
484 cabal-install = released;
485 Cabal_3_10_1_0 = released;
486 Cabal-syntax_3_10_1_0 = released;
487 cabal2nix = released;
488 cabal2nix-unstable = released;
489 funcmp = released;
490 haskell-language-server = lib.subtractLists [
491 # Support ceased as of 1.9.0.0
492 compilerNames.ghc884
493 ] released;
494 hoogle = lib.subtractLists [
495 compilerNames.ghc962
496 ] released;
497 hlint = lib.subtractLists [
498 compilerNames.ghc962
499 ] released;
500 hpack = released;
501 hsdns = released;
502 jailbreak-cabal = released;
503 language-nix = released;
504 large-hashable = [
505 compilerNames.ghc928
506 ];
507 nix-paths = released;
508 titlecase = released;
509 ghc-api-compat = [
510 compilerNames.ghc884
511 compilerNames.ghc8107
512 compilerNames.ghc902
513 ];
514 ghc-bignum = [
515 compilerNames.ghc884
516 compilerNames.ghc8107
517 ];
518 ghc-lib = released;
519 ghc-lib-parser = released;
520 ghc-lib-parser-ex = released;
521 ghc-source-gen = [
522 # Feel free to remove these as they break,
523 # ghc-source-gen currently doesn't support GHC 9.4
524 compilerNames.ghc884
525 compilerNames.ghc8107
526 compilerNames.ghc902
527 compilerNames.ghc928
528 ];
529 ghc-tags = [
530 compilerNames.ghc8107
531 compilerNames.ghc902
532 compilerNames.ghc924
533 compilerNames.ghc925
534 compilerNames.ghc926
535 compilerNames.ghc927
536 compilerNames.ghc928
537 compilerNames.ghc945
538 compilerNames.ghc946
539 compilerNames.ghc962
540 ];
541 hashable = released;
542 primitive = released;
543 weeder = [
544 compilerNames.ghc8107
545 compilerNames.ghc902
546 compilerNames.ghc924
547 compilerNames.ghc925
548 compilerNames.ghc926
549 compilerNames.ghc927
550 compilerNames.ghc928
551 compilerNames.ghc945
552 compilerNames.ghc946
553 compilerNames.ghc962
554 ];
555 })
556 {
557 mergeable = pkgs.releaseTools.aggregate {
558 name = "haskell-updates-mergeable";
559 meta = {
560 description = ''
561 Critical haskell packages that should work at all times,
562 serves as minimum requirement for an update merge
563 '';
564 maintainers = lib.teams.haskell.members;
565 };
566 constituents =
567 let
568 # Filter out all Darwin derivations. We don't want flakey Darwin
569 # derivations and flakey Hydra Darwin builders to block the
570 # mergeable job from successfully building.
571 filterInLinux =
572 lib.filter (drv: drv.system == "x86_64-linux" || drv.system == "aarch64-linux");
573 in
574 filterInLinux
575 (accumulateDerivations [
576 # haskell specific tests
577 jobs.tests.haskell
578 # important top-level packages
579 jobs.cabal-install
580 jobs.cabal2nix
581 jobs.cachix
582 jobs.darcs
583 jobs.haskell-language-server
584 jobs.hledger
585 jobs.hledger-ui
586 jobs.hpack
587 jobs.niv
588 jobs.pandoc
589 jobs.stack
590 jobs.stylish-haskell
591 # important haskell (library) packages
592 jobs.haskellPackages.cabal-plan
593 jobs.haskellPackages.distribution-nixpkgs
594 jobs.haskellPackages.hackage-db
595 jobs.haskellPackages.xmonad
596 jobs.haskellPackages.xmonad-contrib
597 # haskell packages maintained by @peti
598 # imported from the old hydra jobset
599 jobs.haskellPackages.hopenssl
600 jobs.haskellPackages.hsemail
601 jobs.haskellPackages.hsyslog
602 ]);
603 };
604 maintained = pkgs.releaseTools.aggregate {
605 name = "maintained-haskell-packages";
606 meta = {
607 description = "Aggregate jobset of all haskell packages with a maintainer";
608 maintainers = lib.teams.haskell.members;
609 };
610 constituents = accumulateDerivations
611 (builtins.map
612 (name: jobs.haskellPackages."${name}")
613 (maintainedPkgNames pkgs.haskellPackages));
614 };
615
616 muslGHCs = pkgs.releaseTools.aggregate {
617 name = "haskell-pkgsMusl-ghcs";
618 meta = {
619 description = "GHCs built with musl";
620 maintainers = with lib.maintainers; [
621 nh2
622 ];
623 };
624 constituents = accumulateDerivations [
625 jobs.pkgsMusl.haskell.compiler.ghc8102Binary
626 jobs.pkgsMusl.haskell.compiler.ghc8107Binary
627 jobs.pkgsMusl.haskell.compiler.ghc884
628 jobs.pkgsMusl.haskell.compiler.ghc8107
629 jobs.pkgsMusl.haskell.compiler.ghc902
630 jobs.pkgsMusl.haskell.compiler.ghc924
631 jobs.pkgsMusl.haskell.compiler.ghc925
632 jobs.pkgsMusl.haskell.compiler.ghc926
633 jobs.pkgsMusl.haskell.compiler.ghc927
634 jobs.pkgsMusl.haskell.compiler.ghc928
635 jobs.pkgsMusl.haskell.compiler.ghcHEAD
636 jobs.pkgsMusl.haskell.compiler.integer-simple.ghc8107
637 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc902
638 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc924
639 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc925
640 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc926
641 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc927
642 jobs.pkgsMusl.haskell.compiler.native-bignum.ghc928
643 jobs.pkgsMusl.haskell.compiler.native-bignum.ghcHEAD
644 ];
645 };
646
647 staticHaskellPackages = pkgs.releaseTools.aggregate {
648 name = "static-haskell-packages";
649 meta = {
650 description = "Static haskell builds using the pkgsStatic infrastructure";
651 maintainers = [
652 lib.maintainers.sternenseemann
653 lib.maintainers.rnhmjoj
654 ];
655 };
656 constituents = accumulateDerivations [
657 jobs.pkgsStatic.haskellPackages
658 jobs.pkgsStatic.haskell.packages.native-bignum.ghc928
659 ];
660 };
661 }
662 ];
663
664in jobs