Skip to content

Commit 0cf517d

Browse files
authored
Fix selection of dependencies for dev shells (#2367)
This patch fixes the way "non-haskell" dependencies are selected for dev shells (this includes `pre-existing` haskell packages). Currently we only include "non-haskell" dependencies of the haskell packages that are needed by the shell (and not the the ones for the haskell packages that we plan to build in the shell). This means if none of the haskell packages needed depend a particular "non-haskell" dependency it can be left out even if it will be needed to build the haskell packages we plan to build in the shell. Fixes #2359 and probably #2256
1 parent 2db7bed commit 0cf517d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

builder/shell-for.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ let
9393
(removeSelectedInputs (haskellLib.uniqueWithName (lib.concatMap (cfg: cfg.depends) selectedConfigs))
9494
++ additionalPackages);
9595

96+
# For non haskell dependencies (and `pre-existing` haskell packages)
97+
# we want to search all the configs.
98+
allConfigs = selectedConfigs ++
99+
builtins.map (x: (haskellLib.dependToLib x).config) additionalPackages;
100+
96101
# Add the system libraries and build tools of the selected haskell packages to the shell.
97102
# We need to remove any inputs which are selected components (see above).
98103
# `buildInputs`, `propagatedBuildInputs`, and `executableToolDepends` contain component
@@ -115,10 +120,10 @@ let
115120
# Set up a "dummy" component to use with ghcForComponent.
116121
component = {
117122
depends = packageInputs;
118-
pre-existing = lib.concatMap (x: (haskellLib.dependToLib x).config.pre-existing or []) packageInputs;
119-
libs = lib.concatMap (x: (haskellLib.dependToLib x).config.libs or []) packageInputs;
120-
pkgconfig = lib.concatMap (x: (haskellLib.dependToLib x).config.pkgconfig or []) packageInputs;
121-
frameworks = lib.concatMap (x: (haskellLib.dependToLib x).config.frameworks or []) packageInputs;
123+
pre-existing = lib.unique (lib.concatMap (x: (haskellLib.dependToLib x).pre-existing or []) allConfigs);
124+
libs = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).libs or []) allConfigs);
125+
pkgconfig = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).pkgconfig or []) allConfigs);
126+
frameworks = haskellLib.uniqueWithName (lib.concatMap (x: (haskellLib.dependToLib x).frameworks or []) allConfigs);
122127
doExactConfig = false;
123128
};
124129
configFiles = makeConfigFiles {

0 commit comments

Comments
 (0)