on iko/ghcjs-patch-master help sign in
Fix shellFor components argument (#1079)
618ff60Hamish Mackenzie
builder/comp-builder.nix+1−1
@@ -337,7 +337,7 @@ let
337 ++ builtins.concatLists pkgconfig;
337 ++ builtins.concatLists pkgconfig;
338
338
339 buildInputs = component.libs
339 buildInputs = component.libs
340− ++ map (d: d.components.library or d) component.depends;
340+ ++ map haskellLib.dependToLib component.depends;
341
341
342 nativeBuildInputs =
342 nativeBuildInputs =
343 [shellWrappers buildPackages.removeReferencesTo]
343 [shellWrappers buildPackages.removeReferencesTo]
builder/shell-for.nix+9−15
@@ -9,7 +9,7 @@
9 # in the selected packages. If only as subset of the components will be
9 # in the selected packages. If only as subset of the components will be
10 # worked on in the shell then we can pass a different `components` function
10 # worked on in the shell then we can pass a different `components` function
11 # to select those.
11 # to select those.
12−, components ? ps: lib.concatMap haskellLib.getAllComponents (packages hsPkgs)
12+, components ? ps: lib.concatMap haskellLib.getAllComponents (packages ps)
13 # Additional packages to be added unconditionally
13 # Additional packages to be added unconditionally
14, additional ? _: []
14, additional ? _: []
15, withHoogle ? true
15, withHoogle ? true
@@ -50,26 +50,20 @@ let
50 # We have to do this slightly differently because we will be looking at the actual components rather
50 # We have to do this slightly differently because we will be looking at the actual components rather
51 # than the packages.
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 removeSelectedInputs =
54 removeSelectedInputs =
62 # All the components of the selected packages: we shouldn't add any of these as dependencies
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);
56+ let selectedPackageComponents = map (x: x.name) selectedComponents;
57+ in lib.filter (input:
64− in lib.filter (input: !(builtins.elem input.name selectedPackageComponents));
58+ !(builtins.elem ((haskellLib.dependToLib input).name or null) selectedPackageComponents));
65
59
66 # We need to remove any dependencies which are selected packages (see above).
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 # Add the system libraries and build tools of the selected haskell packages to the shell.
64 # Add the system libraries and build tools of the selected haskell packages to the shell.
71 # We need to remove any inputs which are selected components (see above).
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 # derivations, not packages, so we use `removeSelectedInputs`).
67 # derivations, not packages, so we use `removeSelectedInputs`).
74 systemInputs = removeSelectedInputs (lib.concatMap
68 systemInputs = removeSelectedInputs (lib.concatMap
75 (c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents);
69 (c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents);
@@ -115,7 +109,7 @@ let
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"];
119in
113in
120 mkShell (mkDrvArgs // {
114 mkShell (mkDrvArgs // {
121 name = mkDrvArgs.name or name;
115 name = mkDrvArgs.name or name;
lib/default.nix+4
@@ -350,4 +350,8 @@ in {
350 })
350 })
351 ];
351 ];
352 }).config;
352 }).config;
353+
354+ # Converts from a `compoent.depends` value to a library derivation.
355+ # In the case of sublibs the `depends` value should already be the derivation.
356+ dependToLib = d: d.components.library or d;
353}
357}