Skip to content

Commit af5154e

Browse files
committed
Better error for unplanned dependencies with overrides
1 parent 1e35eec commit af5154e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/default.nix

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,19 @@ in {
340340

341341
# Converts from a `compoent.depends` value to a library derivation.
342342
# In the case of sublibs the `depends` value should already be the derivation.
343-
dependToLib = d: d.components.library or d;
343+
dependToLib = d:
344+
# Do simplify this to `d.components.library or d`, as that
345+
# will not give a good error message if the `.library`
346+
# is missing (happens if the package is unplanned,
347+
# but has overrides).
348+
# It would be nice to put an `assert` here, but there is
349+
# currently no good way to get the name of the dependency
350+
# when it is not in the plan. The attribute path of
351+
# `d` in the `nix` error should include the name
352+
# eg. `packages.Cabal.components.library`.
353+
if d ? components
354+
then d.components.library
355+
else d;
344356

345357
projectOverlays = import ./project-overlays.nix {
346358
inherit lib haskellLib;

0 commit comments

Comments
 (0)