on imp/musl-terminfo help sign in
haskell.nix/ci.nix
107 lines 6.0 kB history raw
1# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
2# on a machine with e.g. no way to build the Darwin IFDs you need!
3{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
4, ifdLevel ? 1
5# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
6, restrictEval ? false
7, checkMaterialization ? false }:
8 let
9 inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
10 sources = import ./nix/sources.nix {};
11 nixpkgsVersions = {
12 "R2003" = "nixpkgs-2003";
13 "R2009" = "nixpkgs-2009";
14 };
15 compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: runTests: {
16 inherit (import ./default.nix { inherit checkMaterialization; }) nixpkgsArgs;
17 inherit runTests;
18 }) (
19 # GHC version to cache and whether to run the tests against them.
20 # This list of GHC versions should include everything for which we
21 # have a ./materialized/ghcXXX directory containing the materialized
22 # cabal-install and nix-tools plans. When removing a ghc version
23 # from here (so that is no longer cached) also remove ./materialized/ghcXXX.
24 # Update supported-ghc-versions.md to reflect any changes made here.
25 {
26 ghc865 = true;
27 } // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2009") {
28 ghc883 = false;
29 ghc884 = true;
30 ghc8102 = false;
31 ghc8103 = true;
32 ghc810220201118 = false;
33 });
34 systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
35 # I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
36 linux = "x86_64-linux";
37 darwin = "x86_64-darwin";
38 };
39 crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
40 # We need to use the actual nixpkgs version we're working with here, since the values
41 # of 'lib.systems.examples' are not understood between all versions
42 let lib = nixpkgs.lib;
43 in lib.optionalAttrs (nixpkgsName == "R2009" && (__elem compiler-nix-name ["ghc865" "ghc884"])) {
44 inherit (lib.systems.examples) ghcjs;
45 } // lib.optionalAttrs (system == "x86_64-linux" && (
46 (nixpkgsName == "R2009" && __elem compiler-nix-name ["ghc8101" "ghc8102" "ghc8103" "ghc810220201118"])
47 || (nixpkgsName == "R2003" && __elem compiler-nix-name ["ghc865"]))) {
48 # Windows cross compilation is currently broken on macOS
49 inherit (lib.systems.examples) mingwW64;
50 } // lib.optionalAttrs (system == "x86_64-linux") {
51 # Musl cross only works on linux
52 # aarch64 cross only works on linux
53 inherit (lib.systems.examples) musl64 aarch64-multiplatform;
54 };
55 isDisabled = d:
56 let meta = d.meta or {};
57 in meta.disabled or false;
58in
59dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
60 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
61 # We need this for generic nixpkgs stuff at the right version
62 genericPkgs = import pinnedNixpkgsSrc {};
63 in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: {nixpkgsArgs, runTests}:
64 dimension "System" (systems genericPkgs) (systemName: system:
65 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
66 build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
67 platformFilter = platformFilterGeneric pkgs system;
68 in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
69 # Native builds
70 # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
71 native = pkgs.recurseIntoAttrs ({
72 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
73 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
74 } // pkgs.lib.optionalAttrs runTests {
75 inherit (build) tests tools maintainer-scripts maintainer-script-cache;
76 } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
77 iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy;
78 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
79 hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).components.exes.hello;
80 });
81 }
82 //
83 dimension "Cross system" (crossSystems nixpkgsName genericPkgs compiler-nix-name system) (crossSystemName: crossSystem:
84 # Cross builds
85 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
86 build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
87 in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
88 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
89 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
90 # TODO: look into cross compiling ghc itself
91 # ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}";
92 # TODO: look into making tools work when cross compiling
93 # inherit (build) tools;
94 } // pkgs.lib.optionalAttrs (runTests && crossSystemName != "aarch64-multiplatform") {
95 # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
96 inherit (build) tests;
97 }) // pkgs.lib.optionalAttrs (ifdLevel >= 2 && crossSystemName != "ghcjs") {
98 # GHCJS builds its own template haskell runner.
99 remote-iserv = pkgs.ghc-extra-packages."${compiler-nix-name}".remote-iserv.components.exes.remote-iserv;
100 iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy;
101 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
102 hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).components.exes.hello;
103 })
104 ))
105 )
106 )