From 0ec25e0a00234cded1f28d2d680c76d83202c10a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 8 Oct 2024 17:55:24 +1300 Subject: [PATCH] Add comment and only include library if there is one. --- lib/load-cabal-plan.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/load-cabal-plan.nix b/lib/load-cabal-plan.nix index 6970722823..adf3a6898d 100644 --- a/lib/load-cabal-plan.nix +++ b/lib/load-cabal-plan.nix @@ -47,7 +47,15 @@ let name = pkgs.lib.removePrefix "${prefix}:" n; value = (if cabal2nixComponents == null then {} else cabal2nixComponents.${collectionName}.${name}) // { buildable = true; - } // lookupDependencies hsPkgs (c.depends ++ pkgs.lib.optional (p ? components) p.id) c.exe-depends; + } // lookupDependencies hsPkgs ( + c.depends + # If plan.json uses a single unit for this package (build-type: Custom), + # then it will leave the package itself out of `c.depends` for the + # components of the package. + # Haskell.nix builds the components separately so we need + # to add the `library` component as a dependency. + ++ pkgs.lib.optional (p ? components && p.components ? lib) p.id + ) c.exe-depends; in { inherit name value; } )) components)); in