base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / top-level / release-haskell.nix
blob7a5a87ccf42e42c7b06c02b4542523f7386bab37
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         yi
383         zsh-git-prompt
384         ;
386       # Members of the elmPackages set that are Haskell derivations
387       elmPackages = {
388         inherit (pkgsPlatforms.elmPackages)
389           elm
390           elm-format
391           elm-instrument
392           elmi-to-json
393           ;
394       };
396       # GHCs linked to musl.
397       pkgsMusl =
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"
406             # musl only supports linux, not darwin.
407             "x86_64-darwin"
408             "aarch64-darwin"
409           ]
410           {
411             haskell.compiler = lib.recursiveUpdate
412               (packagePlatforms pkgs.pkgsMusl.haskell.compiler)
413               {
414                 # remove musl ghc865Binary since it is known to be broken and
415                 # causes an evaluation error on darwin.
416                 ghc865Binary = {};
418                 ghcjs = {};
419                 ghcjs810 = {};
420               };
422             # Get some cache going for MUSL-enabled GHC.
423             haskellPackages =
424               {
425                 inherit (packagePlatforms pkgs.pkgsMusl.haskellPackages)
426                   hello
427                   lens
428                   random
429                 ;
430               };
431           };
433       # Test some statically linked packages to catch regressions
434       # and get some cache going for static compilation with GHC.
435       # Use native-bignum to avoid GMP linking problems (LGPL)
436       pkgsStatic =
437         removePlatforms
438           [
439             "aarch64-linux" # times out on Hydra
441             # Static doesn't work on darwin
442             "x86_64-darwin"
443             "aarch64-darwin"
444           ] {
445             haskellPackages = {
446               inherit (packagePlatforms pkgs.pkgsStatic.haskellPackages)
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             };
457             haskell.packages.native-bignum.ghc948 = {
458               inherit (packagePlatforms pkgs.pkgsStatic.haskell.packages.native-bignum.ghc948)
459                 hello
460                 lens
461                 random
462                 QuickCheck
463                 cabal2nix
464                 terminfo # isn't bundled for cross
465                 xhtml # isn't bundled for cross
466               ;
467             };
469             haskell.packages.native-bignum.ghc983 = {
470               inherit (packagePlatforms pkgs.pkgsStatic.haskell.packages.native-bignum.ghc983)
471                 hello
472                 random
473                 QuickCheck
474                 terminfo # isn't bundled for cross
475                 ;
476             };
477           };
479       pkgsCross = {
480         ghcjs =
481           removePlatforms
482             [
483               # Hydra output size of 3GB is exceeded
484               "aarch64-linux"
485             ]
486             {
487               haskellPackages = {
488                 inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskellPackages)
489                   ghc
490                   hello
491                   microlens
492                 ;
493               };
495               haskell.packages.ghc98 = {
496                 inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghc98)
497                   ghc
498                   hello
499                   microlens
500                 ;
501               };
503               haskell.packages.ghcHEAD = {
504                 inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghcHEAD)
505                   ghc
506                   hello
507                   microlens
508                 ;
509               };
510             };
512         riscv64 = {
513           # Cross compilation of GHC
514           haskell.compiler = {
515             inherit (packagePlatforms pkgs.pkgsCross.riscv64.haskell.compiler)
516               # Our oldest GHC which still uses its own expression. 8.10.7 can
517               # theoretically be used to chain bootstrap all GHCs on riscv64
518               # which doesn't have official bindists.
519               ghc8107
520               # Latest GHC we are able to cross-compile.
521               ghc948
522               ;
523           };
524         };
526         aarch64-multiplatform = {
527           # Cross compilation of GHC
528           haskell.compiler = {
529             inherit (packagePlatforms pkgs.pkgsCross.aarch64-multiplatform.haskell.compiler)
530               # Uses a separate expression and LLVM backend for aarch64.
531               ghc8107
532               # Latest GHC we are able to cross-compile. Uses NCG backend.
533               ghc948
534               ;
535           };
536         };
537       };
538     })
539     (versionedCompilerJobs {
540       # Packages which should be checked on more than the
541       # default GHC version. This list can be used to test
542       # the state of the package set with newer compilers
543       # and to confirm that critical packages for the
544       # package sets (like Cabal, jailbreak-cabal) are
545       # working as expected.
546       cabal-install = lib.subtractLists [
547         # It is recommended to use pkgs.cabal-install instead of cabal-install
548         # from the package sets. Due to (transitively) requiring recent versions
549         # of core packages, it is not always reasonable to get cabal-install to
550         # work with older compilers.
551         compilerNames.ghc8107
552         compilerNames.ghc902
553         compilerNames.ghc925
554         compilerNames.ghc926
555         compilerNames.ghc927
556         compilerNames.ghc928
557         compilerNames.ghc945
558         compilerNames.ghc946
559         compilerNames.ghc947
560         compilerNames.ghc948
561         compilerNames.ghc9101
562       ] released;
563       Cabal_3_10_3_0 = released;
564       Cabal_3_12_1_0 = released;
565       Cabal_3_14_0_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       nix-paths = released;
594       titlecase = lib.subtractLists [
595         compilerNames.ghc9101
596       ] released;
597       ghc-api-compat = [
598         compilerNames.ghc8107
599         compilerNames.ghc902
600       ];
601       ghc-bignum = [
602         compilerNames.ghc8107
603       ];
604       ghc-lib = lib.subtractLists [
605         compilerNames.ghc9101
606       ] released;
607       ghc-lib-parser = lib.subtractLists [
608         compilerNames.ghc9101
609       ] released;
610       ghc-lib-parser-ex = lib.subtractLists [
611         compilerNames.ghc9101
612       ] released;
613       ghc-source-gen = [
614         # Feel free to remove these as they break,
615         compilerNames.ghc8107
616         compilerNames.ghc902
617         compilerNames.ghc928
618       ];
619       ghc-tags = lib.subtractLists [
620         compilerNames.ghc9101
621       ] released;
622       hashable = lib.subtractLists [
623         compilerNames.ghc9101
624       ] released;
625       primitive = lib.subtractLists [
626         compilerNames.ghc9101
627       ] released;
628       weeder = lib.subtractLists [
629         compilerNames.ghc9101
630       ] released;
631     })
632     {
633       mergeable = pkgs.releaseTools.aggregate {
634         name = "haskell-updates-mergeable";
635         meta = {
636           description = ''
637             Critical haskell packages that should work at all times,
638             serves as minimum requirement for an update merge
639           '';
640           maintainers = lib.teams.haskell.members;
641         };
642         constituents =
643           accumulateDerivations [
644             # haskell specific tests
645             jobs.tests.haskell
646             # important top-level packages
647             jobs.cabal-install
648             jobs.cabal2nix
649             jobs.cachix
650             jobs.darcs
651             jobs.haskell-language-server
652             jobs.hledger
653             jobs.hledger-ui
654             jobs.hpack
655             jobs.niv
656             jobs.pandoc
657             jobs.stack
658             jobs.stylish-haskell
659             jobs.shellcheck
660             # important haskell (library) packages
661             jobs.haskellPackages.cabal-plan
662             jobs.haskellPackages.distribution-nixpkgs
663             jobs.haskellPackages.hackage-db
664             jobs.haskellPackages.xmonad
665             jobs.haskellPackages.xmonad-contrib
666             # haskell packages maintained by @peti
667             # imported from the old hydra jobset
668             jobs.haskellPackages.hopenssl
669             jobs.haskellPackages.hsemail
670             jobs.haskellPackages.hsyslog
671            ];
672       };
673       maintained = pkgs.releaseTools.aggregate {
674         name = "maintained-haskell-packages";
675         meta = {
676           description = "Aggregate jobset of all haskell packages with a maintainer";
677           maintainers = lib.teams.haskell.members;
678         };
679         constituents = accumulateDerivations
680           (builtins.map
681             (name: jobs.haskellPackages."${name}")
682             (maintainedPkgNames pkgs.haskellPackages));
683       };
685       muslGHCs = pkgs.releaseTools.aggregate {
686         name = "haskell-pkgsMusl-ghcs";
687         meta = {
688           description = "GHCs built with musl";
689           maintainers = with lib.maintainers; [
690             nh2
691           ];
692         };
693         constituents = accumulateDerivations [
694           jobs.pkgsMusl.haskell.compiler.ghc8107Binary
695           jobs.pkgsMusl.haskell.compiler.ghc8107
696           jobs.pkgsMusl.haskell.compiler.ghc902
697           jobs.pkgsMusl.haskell.compiler.ghc925
698           jobs.pkgsMusl.haskell.compiler.ghc926
699           jobs.pkgsMusl.haskell.compiler.ghc927
700           jobs.pkgsMusl.haskell.compiler.ghc928
701           jobs.pkgsMusl.haskell.compiler.ghcHEAD
702           jobs.pkgsMusl.haskell.compiler.integer-simple.ghc8107
703           jobs.pkgsMusl.haskell.compiler.native-bignum.ghc902
704           jobs.pkgsMusl.haskell.compiler.native-bignum.ghc925
705           jobs.pkgsMusl.haskell.compiler.native-bignum.ghc926
706           jobs.pkgsMusl.haskell.compiler.native-bignum.ghc927
707           jobs.pkgsMusl.haskell.compiler.native-bignum.ghc928
708           jobs.pkgsMusl.haskell.compiler.native-bignum.ghcHEAD
709         ];
710       };
712       staticHaskellPackages = pkgs.releaseTools.aggregate {
713         name = "static-haskell-packages";
714         meta = {
715           description = "Static haskell builds using the pkgsStatic infrastructure";
716           maintainers = [
717             lib.maintainers.sternenseemann
718             lib.maintainers.rnhmjoj
719           ];
720         };
721         constituents = accumulateDerivations [
722           jobs.pkgsStatic.haskell.packages.native-bignum.ghc948 # non-hadrian
723           jobs.pkgsStatic.haskellPackages
724           jobs.pkgsStatic.haskell.packages.native-bignum.ghc983
725         ];
726       };
727     }
728   ];
730 in jobs