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