|
9 | 9 | # in the selected packages. If only as subset of the components will be
|
10 | 10 | # worked on in the shell then we can pass a different `components` function
|
11 | 11 | # to select those.
|
12 |
| -, components ? ps: lib.concatMap haskellLib.getAllComponents (packages hsPkgs) |
| 12 | +, components ? ps: lib.concatMap haskellLib.getAllComponents (packages ps) |
13 | 13 | # Additional packages to be added unconditionally
|
14 | 14 | , additional ? _: []
|
15 | 15 | , withHoogle ? true
|
|
50 | 50 | # We have to do this slightly differently because we will be looking at the actual components rather
|
51 | 51 | # than the packages.
|
52 | 52 |
|
53 |
| - # Given a list of packages, removes those which were selected as part of the shell. |
54 |
| - # We do this on the basis of their identifiers being the same, not direct equality (why?). |
55 |
| - removeSelectedPackages = |
56 |
| - # All the identifiers of the selected packages |
57 |
| - let selectedPackageIds = map (p: p.identifier) selectedPackages; |
58 |
| - in lib.filter (input: !(builtins.elem (input.identifier or null) selectedPackageIds)); |
59 |
| - |
60 |
| - # Given a list of derivations, removes those which are components of packages which were selected as part of the shell. |
| 53 | + # Given a list of `depends`, removes those which are components of packages which were selected as part of the shell. |
61 | 54 | removeSelectedInputs =
|
62 | 55 | # All the components of the selected packages: we shouldn't add any of these as dependencies
|
63 |
| - let selectedPackageComponents = map (x: x.name) (lib.concatMap haskellLib.getAllComponents selectedPackages); |
64 |
| - in lib.filter (input: !(builtins.elem input.name selectedPackageComponents)); |
| 56 | + let selectedPackageComponents = map (x: x.name) selectedComponents; |
| 57 | + in lib.filter (input: |
| 58 | + !(builtins.elem ((haskellLib.dependToLib input).name or null) selectedPackageComponents)); |
65 | 59 |
|
66 | 60 | # We need to remove any dependencies which are selected packages (see above).
|
67 |
| - # `depends` contains packages so we use 'removeSelectedPackages`. |
68 |
| - packageInputs = removeSelectedPackages (lib.concatMap (cfg: cfg.depends) selectedConfigs) ++ additionalPackages; |
| 61 | + packageInputs = removeSelectedInputs (lib.concatMap (cfg: cfg.depends) selectedConfigs) |
| 62 | + ++ additionalPackages; |
69 | 63 |
|
70 | 64 | # Add the system libraries and build tools of the selected haskell packages to the shell.
|
71 | 65 | # We need to remove any inputs which are selected components (see above).
|
72 |
| - # `buildInputs`, `propagatedBuildInputs`, and `executableToolDepends` contain component |
| 66 | + # `buildInputs`, `propagatedBuildInputs`, and `executableToolDepends` contain component |
73 | 67 | # derivations, not packages, so we use `removeSelectedInputs`).
|
74 | 68 | systemInputs = removeSelectedInputs (lib.concatMap
|
75 | 69 | (c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents);
|
|
115 | 109 | }
|
116 | 110 | ));
|
117 | 111 |
|
118 |
| - mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"]; |
| 112 | + mkDrvArgs = builtins.removeAttrs args ["packages" "components" "additional" "withHoogle" "tools"]; |
119 | 113 | in
|
120 | 114 | mkShell (mkDrvArgs // {
|
121 | 115 | name = mkDrvArgs.name or name;
|
|
0 commit comments