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