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