@@ -3,14 +3,20 @@
33{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
44, ifdLevel ? 3
55# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
6−, restrictEval ? false }:
7−let
6+, restrictEval ? false
7+, checkMaterialization ? false }:
8+ let
89 inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
9− inherit (import ./default.nix { checkMaterialization = false; }) sources nixpkgsArgs;
10+ sources = import ./nix/sources.nix {};
1011 nixpkgsVersions = {
1112 "R1909" = "nixpkgs-1909";
1213 "R2003" = "nixpkgs-2003";
1314 };
15+ compilerNixNames = builtins.mapAttrs (defaultCompilerNixName: _:
16+ (import ./default.nix { inherit checkMaterialization defaultCompilerNixName; }).nixpkgsArgs) {
17+ ghc865 = {};
18+ ghc883 = {};
19+ };
1420 systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
1521 # I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
1622 linux = "x86_64-linux";
@@ -33,54 +39,45 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
3339 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
3440 # We need this for generic nixpkgs stuff at the right version
3541 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− compilers = {
41− inherit (pkgs.haskell-nix.compiler) ghc865 ghc883;
42− };
43− in filterAttrsOnlyRecursive (_: v: platformFilter v) {
44− # Native builds
45− # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
46− native = pkgs.recurseIntoAttrs ({
47− inherit (build) tests tools maintainer-scripts maintainer-script-cache;
48− ghc = pkgs.recurseIntoAttrs compilers;
49− } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
50− iserv-proxy = pkgs.recurseIntoAttrs (
51− pkgs.lib.mapAttrs (ghcName: _:
52− pkgs.ghc-extra-packages."${ghcName}".iserv-proxy.components.exes.iserv-proxy
53− ) compilers);
54− } // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
55− hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
56− });
57− }
58− //
59− dimension "Cross system" (crossSystems nixpkgsName genericPkgs system) (crossSystemName: crossSystem:
60− # Cross builds
61− let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
42+ in dimension "GHC version" compilerNixNames (compilerNixName: nixpkgsArgs:
43+ dimension "System" (systems genericPkgs) (systemName: system:
44+ let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
6245 build = import ./build.nix { inherit pkgs ifdLevel; };
63− in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) {
64− ghc = pkgs.recurseIntoAttrs compilers;
65− # TODO: look into making tools work when cross compiling
66− # inherit (build) tools;
67− } // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
68− remote-iserv = pkgs.recurseIntoAttrs (
69− pkgs.lib.mapAttrs (ghcName: _:
70− pkgs.ghc-extra-packages."${ghcName}".remote-iserv.components.exes.remote-iserv
71− ) compilers);
72− iserv-proxy = pkgs.recurseIntoAttrs (
73− pkgs.lib.mapAttrs (ghcName: _:
74− pkgs.ghc-extra-packages."${ghcName}".iserv-proxy.components.exes.iserv-proxy
75− ) compilers);
76− } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
77− hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
46+ platformFilter = platformFilterGeneric pkgs system;
47+ in filterAttrsOnlyRecursive (_: v: platformFilter v) {
48+ # Native builds
49+ # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
50+ native = pkgs.recurseIntoAttrs ({
51+ inherit (build) tests tools maintainer-scripts maintainer-script-cache;
52+ ghc = pkgs.haskell-nix.compiler."${compilerNixName}";
53+ } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
54+ iserv-proxy = pkgs.ghc-extra-packages."${compilerNixName}".iserv-proxy.components.exes.iserv-proxy;
55+ } // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
56+ hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
57+ });
7858 }
7959 //
80− # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
81− pkgs.lib.optionalAttrs (crossSystemName != "aarch64-multiplatform") {
82− inherit (build) tests;
83− })
60+ dimension "Cross system" (crossSystems nixpkgsName genericPkgs system) (crossSystemName: crossSystem:
61+ # Cross builds
62+ let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
63+ build = import ./build.nix { inherit pkgs ifdLevel; };
64+ in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) {
65+ # TODO: look into cross compiling ghc itself
66+ # ghc = pkgs.haskell-nix.compiler."${compilerNixName}";
67+ # TODO: look into making tools work when cross compiling
68+ # inherit (build) tools;
69+ } // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
70+ remote-iserv = pkgs.ghc-extra-packages."${compilerNixName}".remote-iserv.components.exes.remote-iserv;
71+ iserv-proxy = pkgs.ghc-extra-packages."${compilerNixName}".iserv-proxy.components.exes.iserv-proxy;
72+ } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
73+ hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
74+ }
75+ //
76+ # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
77+ pkgs.lib.optionalAttrs (crossSystemName != "aarch64-multiplatform") {
78+ inherit (build) tests;
79+ })
80+ )
8481 )
8582 )
8683)