on iko/ghcjs-patch-master help sign in
`compiler-nix-name` fix for `shellFor` `tools` (#719)

Currently the ghc version is picked to match the `shellFor` project and you cannot replace it by specifying `compiler-nix-name`. This change fixes that and also uses `ghcOverride` so warning to asking for a `compiler-nix-name` is not displayed when the compiler has already been picked (by the project that shellFor is for).

commit21a6d6090a64ef5956c9625bcf00a15045d65042 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateSun 21 Jun 2020, 22:34 (6 years ago) parent5291959
1 file changed+7−4
overlays/tools.nix+7−4
overlays/tools.nix+7−4
@@ -68,12 +68,15 @@ in { haskell-nix = prev.haskell-nix // {
6868 tools = lib.mapAttrs final.haskell-nix.tool;
6969
7070 # Like `tools` but allows default ghc to be specified
71− toolsForGhc = ghc: toolSet:
71+ toolsForGhc = ghcOverride: toolSet:
7272 final.haskell-nix.tools (
7373 lib.mapAttrs (name: versionOrArgs:
74− # Add default ghc if not specified in the args
75− { inherit ghc; }
76− // final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs
74+ let args = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
75+ in
76+ # Add default ghc if not specified in the args
77+ (lib.optionalAttrs (!(args ? "compiler-nix-name" || args ? "ghc"))
78+ { inherit ghcOverride; }
79+ ) // args
7780 ) toolSet
7881 );
7982