|
1 | | -# these are patched nixpkgs that include the following PRs: |
2 | | -# - https://github.com/NixOS/nixpkgs/pull/71216 |
3 | | -# - https://github.com/NixOS/nixpkgs/pull/68398 |
4 | | - |
| 1 | +# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluting |
| 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 }: |
5 | 7 | let |
6 | | - inherit (import ./dimension.nix) dimension; |
| 8 | + inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive; |
| 9 | + inherit (import ./default.nix {}) sources nixpkgsArgs; |
7 | 10 | nixpkgsVersions = { |
8 | | -# "release-18.09" = builtins.fetchTarball "https://github.com/input-output-hk/nixpkgs/archive/7e4dcacbf066a8e2d12693a9de1fb30c77081c5d.tar.gz"; |
9 | | - "release-19.03" = builtins.fetchTarball "https://github.com/input-output-hk/nixpkgs/archive/a8f81dc037a5977414a356dd068f2621b3c89b60.tar.gz"; |
10 | | - # "release-19.09" = builtins.fetchTarball "https://github.com/input-output-hk/nixpkgs/archive/3d623a406cec9052ae0a16a79ce3ce9de11236bb.tar.gz"; |
| 11 | + "R1903" = "nixpkgs-1903"; |
| 12 | + "R1909" = "nixpkgs-1909"; |
11 | 13 | }; |
12 | | - systems = { |
13 | | - "x86_64-linux" = {}; |
| 14 | + systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) { |
| 15 | + # I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux! |
| 16 | + linux = "x86_64-linux"; |
| 17 | + darwin = "x86_64-darwin"; |
14 | 18 | }; |
15 | | - crossSystems = { |
16 | | - "x86_64-pc-mingw32" = {}; |
| 19 | + crossSystems = nixpkgsName: nixpkgs: system: |
| 20 | + # We need to use the actual nixpkgs version we're working with here, since the values |
| 21 | + # of 'lib.systems.examples' are not understood between all versions |
| 22 | + let lib = nixpkgs.lib; |
| 23 | + in lib.optionalAttrs (system == "x86_64-linux" || nixpkgsName == "R1903") { |
| 24 | + # Windows cross compilation is currently broken on macOS for nixpkgs 19.09 (works on 19.03) |
| 25 | + inherit (lib.systems.examples) mingwW64; |
| 26 | + } // lib.optionalAttrs (system == "x86_64-linux") { |
| 27 | + # Musl cross only works on linux |
| 28 | + # aarch64 cross only works on linux |
| 29 | + inherit (lib.systems.examples) musl64 aarch64-multiplatform; |
17 | 30 | }; |
18 | | - haskellNixArgs = import ./.; |
19 | 31 | in |
20 | | -dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgsSrc: |
21 | | - dimension "System" systems (system: _: |
22 | | - # Native builds |
23 | | - # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native? |
24 | | - let pkgs = import nixpkgsSrc (haskellNixArgs // { inherit system; }); |
25 | | - in pkgs.recurseIntoAttrs { |
26 | | - hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2";}).components.exes.hello; |
27 | | - iserv-proxy = pkgs.ghc-extra-packages.ghc865.iserv-proxy.components.exes.iserv-proxy; |
28 | | - ghc = pkgs.recurseIntoAttrs pkgs.haskell-nix.compiler; |
29 | | - tests = pkgs.lib.optionalAttrs (system == "x86_64-linux") (import ./test { inherit pkgs; }); |
| 32 | +dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin: |
| 33 | + let pinnedNixpkgsSrc = sources.${nixpkgs-pin}; |
| 34 | + # We need this for generic nixpkgs stuff at the right version |
| 35 | + genericPkgs = import pinnedNixpkgsSrc {}; |
| 36 | + in dimension "System" (systems genericPkgs) (systemName: system: |
| 37 | + let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; }); |
| 38 | + build = import ./build.nix { inherit pkgs ifdLevel; }; |
| 39 | + platformFilter = platformFilterGeneric pkgs system; |
| 40 | + in filterAttrsOnlyRecursive (_: v: platformFilter v) { |
| 41 | + # Native builds |
| 42 | + # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native? |
| 43 | + native = pkgs.recurseIntoAttrs { |
| 44 | + inherit (build) tests maintainer-scripts maintainer-script-cache; |
| 45 | + hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello; |
| 46 | + iserv-proxy = pkgs.ghc-extra-packages.ghc865.iserv-proxy.components.exes.iserv-proxy; |
| 47 | + ghc = pkgs.recurseIntoAttrs pkgs.haskell-nix.compiler; |
| 48 | + }; |
30 | 49 | } |
31 | 50 | // |
32 | | - dimension "Cross system" crossSystems (crossSystem: _: |
| 51 | + dimension "Cross system" (crossSystems nixpkgsName genericPkgs system) (crossSystemName: crossSystem: |
33 | 52 | # Cross builds |
34 | | - let pkgs = import nixpkgsSrc (haskellNixArgs // { inherit system; crossSystem.config = crossSystem; }); |
| 53 | + let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; }); |
| 54 | + build = import ./build.nix { inherit pkgs ifdLevel; }; |
35 | 55 | in pkgs.recurseIntoAttrs { |
36 | | - hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2";}).components.exes.hello; |
37 | | - |
| 56 | + hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello; |
38 | 57 | iserv-proxy = pkgs.ghc-extra-packages.ghc865.iserv-proxy.components.exes.iserv-proxy; |
39 | | - |
40 | 58 | remote-iserv = pkgs.ghc-extra-packages.ghc865.remote-iserv.components.exes.remote-iserv; |
41 | 59 | } |
| 60 | + // |
| 61 | + # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513 |
| 62 | + pkgs.lib.optionalAttrs (crossSystemName != "aarch64-multiplatform") build.tests |
42 | 63 | ) |
43 | 64 | ) |
44 | 65 | ) |
0 commit comments