on hkm/libsodium-vrf help sign in
haskell.nix/ci.nix
109 lines 6.2 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 "R2009" = "nixpkgs-2009";
13 "R2105" = "nixpkgs-2105";
14 "unstable" = "nixpkgs-unstable";
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 nixpkgs.lib.optionalAttrs (nixpkgsName == "R2009") {
27 ghc865 = false;
28 ghc8105 = false;
29 } // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2105") {
30 ghc865 = false;
31 ghc8105 = true;
32 } // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
33 ghc865 = false;
34 ghc884 = false; # Native version is used to boot 9.0.1
35 ghc8105 = true;
36 ghc901 = true;
37 ghc810420210212 = false;
38 });
39 systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
40 # I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
41 linux = "x86_64-linux";
42 darwin = "x86_64-darwin";
43 };
44 crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
45 # We need to use the actual nixpkgs version we're working with here, since the values
46 # of 'lib.systems.examples' are not understood between all versions
47 let lib = nixpkgs.lib;
48 in lib.optionalAttrs (nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc8105"])) {
49 inherit (lib.systems.examples) ghcjs;
50 } // lib.optionalAttrs (system == "x86_64-linux" &&
51 nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc8105"])) {
52 # Windows cross compilation is currently broken on macOS
53 inherit (lib.systems.examples) mingwW64;
54 } // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && compiler-nix-name == "ghc8105") {
55 # Musl cross only works on linux
56 # aarch64 cross only works on linux
57 inherit (lib.systems.examples) musl64 aarch64-multiplatform;
58 };
59 isDisabled = d: d.meta.disabled or false;
60in
61dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
62 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
63 # We need this for generic nixpkgs stuff at the right version
64 genericPkgs = import pinnedNixpkgsSrc {};
65 in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: {nixpkgsArgs, runTests}:
66 dimension "System" (systems genericPkgs) (systemName: system:
67 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
68 build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
69 platformFilter = platformFilterGeneric pkgs system;
70 in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
71 # Native builds
72 # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
73 native = pkgs.recurseIntoAttrs ({
74 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
75 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
76 } // pkgs.lib.optionalAttrs runTests {
77 inherit (build) tests tools maintainer-scripts maintainer-script-cache;
78 } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
79 iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
80 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
81 hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).getComponent "exe:hello";
82 });
83 }
84 //
85 dimension "Cross system" (crossSystems nixpkgsName genericPkgs compiler-nix-name system) (crossSystemName: crossSystem:
86 # Cross builds
87 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
88 build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
89 in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
90 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
91 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
92 # TODO: look into cross compiling ghc itself
93 # ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}";
94 # TODO: look into making tools work when cross compiling
95 # inherit (build) tools;
96 } // pkgs.lib.optionalAttrs (runTests && crossSystemName != "aarch64-multiplatform") {
97 # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
98 inherit (build) tests;
99 }) // pkgs.lib.optionalAttrs (ifdLevel >= 2 && crossSystemName != "ghcjs") {
100 # GHCJS builds its own template haskell runner.
101 remote-iserv = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "remote-iserv:exe:remote-iserv";
102 iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
103 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
104 hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).getComponent "exe:hello";
105 })
106 ))
107 )
108 )