From ce047883ac95bb96e7f8361ff84631ce56dd2397 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Mon, 1 Aug 2022 23:57:29 +1200 Subject: [PATCH] Fix tool functions (#1570) --- builder/shell-for.nix | 2 +- overlays/haskell.nix | 8 ++++---- overlays/tools.nix | 12 ++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/builder/shell-for.nix b/builder/shell-for.nix index 8c34a8ad..15d21a8f 100644 --- a/builder/shell-for.nix +++ b/builder/shell-for.nix @@ -152,7 +152,7 @@ in nativeBuildInputs = [ ghcEnv ] ++ nativeBuildInputs ++ mkDrvArgs.nativeBuildInputs or [] - ++ lib.attrValues (buildPackages.haskell-nix.tools evalPackages compiler.nix-name tools) + ++ lib.attrValues (buildPackages.haskell-nix.tools' evalPackages compiler.nix-name tools) # If this shell is a cross compilation shell include # wrapper script for running cabal build with appropriate args. # Includes `--with-compiler` in case the `cabal.project` file has `with-compiler:` in it. diff --git a/overlays/haskell.nix b/overlays/haskell.nix index 0b643e8f..36b3ceac 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -496,8 +496,8 @@ final: prev: { inherit pkg-set; plan-nix = callProjectResults.projectNix; inherit (callProjectResults) index-state; - tool = final.buildPackages.haskell-nix.tool pkg-set.config.compiler.nix-name; - tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name; + tool = final.buildPackages.haskell-nix.tool' evalPackages pkg-set.config.compiler.nix-name; + tools = final.buildPackages.haskell-nix.tools' evalPackages pkg-set.config.compiler.nix-name; roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name; projectFunction = haskell-nix: haskell-nix.cabalProject'; inherit projectModule buildProject args; @@ -788,8 +788,8 @@ final: prev: { inherit (pkg-set.config) hsPkgs; inherit pkg-set; stack-nix = callProjectResults.projectNix; - tool = final.buildPackages.haskell-nix.tool pkg-set.config.compiler.nix-name; - tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name; + tool = final.buildPackages.haskell-nix.tool' evalPackages pkg-set.config.compiler.nix-name; + tools = final.buildPackages.haskell-nix.tools' evalPackages pkg-set.config.compiler.nix-name; roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name; projectFunction = haskell-nix: haskell-nix.stackProject'; inherit projectModule buildProject args; diff --git a/overlays/tools.nix b/overlays/tools.nix index b7cbad30..5d348767 100644 --- a/overlays/tools.nix +++ b/overlays/tools.nix @@ -77,12 +77,16 @@ in { haskell-nix = prev.haskell-nix // { tool = compiler-nix-name: name: versionOrMod: final.haskell-nix.hackage-tool ( final.haskell-nix.haskellLib.versionOrModToMods versionOrMod - ++ [{ inherit compiler-nix-name name; }] + ++ [(lib.mapAttrs (_: lib.mkOverride 1100) { inherit compiler-nix-name name; })] ); - tools = evalPackages: compiler-nix-name: - lib.mapAttrs (name: versionOrMod: + # tool with a default evalPackages to use. + tool' = evalPackages: compiler-nix-name: name: versionOrMod: final.haskell-nix.hackage-tool ( final.haskell-nix.haskellLib.versionOrModToMods versionOrMod - ++ [{ inherit evalPackages compiler-nix-name name; }])); + ++ [(lib.mapAttrs (_: lib.mkOverride 1100) { inherit evalPackages compiler-nix-name name; })] + ); + + tools = compiler-nix-name: lib.mapAttrs (final.haskell-nix.tool compiler-nix-name); + tools' = evalPackages: compiler-nix-name: lib.mapAttrs (final.haskell-nix.tool' evalPackages compiler-nix-name); }; }