Skip to content

Commit ade64e8

Browse files
Try #1769:
2 parents f1f3300 + 9289103 commit ade64e8

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

builder/comp-builder.nix

+7-4
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,12 @@ let
239239
executableToolDepends =
240240
(lib.concatMap (c: if c.isHaskell or false
241241
then builtins.attrValues (c.components.exes or {})
242-
else [c])
243-
(builtins.filter (x: !(isNull x))
244-
(map
242+
else [c])
243+
(builtins.filter (x: !(isNull x)
244+
# We always exclude hsc2hs from build-tools because it is unecessary as it is provided by ghc
245+
# and hsc2hs from ghc is first in PATH so the one from build-tools is never used.
246+
&& x.identifier.name or "" != "hsc2hs")
247+
(map
245248
(p: if builtins.isFunction p
246249
then p { inherit (package.identifier) version; inherit revision; }
247250
else p) build-tools))) ++
@@ -328,7 +331,7 @@ let
328331
outputHashMode = "recursive";
329332
outputHashAlgo = "sha256";
330333
};
331-
334+
332335
drv = stdenv.mkDerivation (commonAttrs // contentAddressedAttrs // {
333336
pname = nameOnly;
334337
inherit (package.identifier) version;

builder/shell-for.nix

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ let
6767
selectedComponents =
6868
lib.filter isSelectedComponent (lib.attrValues transitiveDependenciesComponents);
6969

70+
allHsPkgsComponents = lib.concatMap haskellLib.getAllComponents (builtins.attrValues hsPkgs);
71+
7072
# Given a list of `depends`, removes those which are selected components
7173
removeSelectedInputs =
7274
lib.filter (input: !(isSelectedComponent input));
@@ -105,7 +107,10 @@ let
105107
systemInputs = removeSelectedInputs (uniqueWithName allSystemInputs);
106108

107109
nativeBuildInputs = removeSelectedInputs
108-
(lib.concatMap (c: c.executableToolDepends) selectedComponents);
110+
(uniqueWithName (lib.concatMap (c: c.executableToolDepends)
111+
# When not using `exactDeps` cabal may try to build arbitrary dependencies
112+
# so in this case we need to provide the build tools for all of hsPkgs:
113+
(if exactDeps then selectedComponents else allHsPkgsComponents)));
109114

110115
# Set up a "dummy" component to use with ghcForComponent.
111116
component = {

0 commit comments

Comments
 (0)