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