on iko/ghcjs-patch-master help sign in
Allow older `ghc` versions in `cabalProject` (#817)

Currently the `dummy-ghc-data`, `nix-tools` plan and `cabal-install` plan must be materialized for the selected `ghc`. This change relaxes that restriction and will instead use `nix-tools` and `cabal-install` built with a fixed `ghc` version (currently `ghc865`) and will calculate the `dummy-ghc-data` as an IFD. It will `__trace` a warning of the form: ``` WARNING: No materialized dummy-ghc-data for ghc-8.6.4-x86_64-darwin. ```

commitfa25a679bcaf46393dd9b1a8a1b5634236f9591c authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateFri 14 Aug 2020, 19:22 (6 years ago) parent2db0b60
1 file changed+17−10
lib/call-cabal-project-to-nix.nix+17−10
lib/call-cabal-project-to-nix.nix+17−10
@@ -21,8 +21,8 @@ in
2121, caller ? "callCabalProjectToNix" # Name of the calling funcion for better warning messages
2222, ghc ? null # Deprecated in favour of `compiler-nix-name`
2323, ghcOverride ? null # Used when we need to set ghc explicitly during bootstrapping
24−, nix-tools ? evalPackages.haskell-nix.nix-tools.${compiler-nix-name} # When building cabal projects we use the nix-tools
25−, cabal-install ? evalPackages.haskell-nix.cabal-install.${compiler-nix-name} # and cabal-install compiled with matching ghc version
24+, nix-tools ? evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name} # When building cabal projects we use the nix-tools
25+, cabal-install ? evalPackages.haskell-nix.cabal-install-unchecked.${compiler-nix-name} # and cabal-install compiled with matching ghc version
2626, configureArgs ? "" # Extra arguments to pass to `cabal v2-configure`.
2727 # `--enable-tests --enable-benchmarks` are included by default.
2828 # If the tests and benchmarks are not needed and they
@@ -212,14 +212,21 @@ let
212212 # The solution here is to capture the GHC outputs that `cabal v2-configure`
213213 # requests and materialize it so that the real GHC is only needed
214214 # when `checkMaterialization` is set.
215− dummy-ghc-data = pkgs.haskell-nix.materialize ({
216− sha256 = null;
217− sha256Arg = "sha256";
218− materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}";
219− reasonNotSafe = null;
220− } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
221− inherit checkMaterialization;
222− }) (
215+ dummy-ghc-data =
216+ let
217+ materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}";
218+ in pkgs.haskell-nix.materialize ({
219+ sha256 = null;
220+ sha256Arg = "sha256";
221+ materialized = if __pathExists materialized
222+ then materialized
223+ else __trace ("WARNING: No materialized dummy-ghc-data for "
224+ + "${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}.")
225+ null;
226+ reasonNotSafe = null;
227+ } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
228+ inherit checkMaterialization;
229+ }) (
223230 runCommand ("dummy-data-" + ghc.name) {
224231 nativeBuildInputs = [ ghc ];
225232 } ''