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