Skip to content

Commit f01d23c

Browse files
committed
Enable component overrides by package name
1 parent baad5ae commit f01d23c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

overlays/haskell.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ final: prev: {
659659
hsPkgs.pkgsBuildBuild.${to-key by-id.${d}}.components.exes.${final.lib.removePrefix "exe:" by-id.${d}.component-name};
660660
getComponents = cabal2nixComponents: hsPkgs: p:
661661
let
662-
components = p.components or { ${p.component-name} = { inherit (p) depends exe-depends; }; };
662+
components = p.components or { ${p.component-name or "lib"} = { inherit (p) depends exe-depends; }; };
663663
componentsWithPrefix = collectionName: prefix:
664664
final.lib.listToAttrs (final.lib.concatLists (final.lib.mapAttrsToList (n: c:
665665
final.lib.optional (final.lib.hasPrefix "${prefix}:" n) (
@@ -749,6 +749,16 @@ final: prev: {
749749
final.lib.concatMap (p:
750750
final.lib.optional (p.type == "pre-existing") p.pkg-name) plan-json.install-plan;
751751
}
752+
({config, ...}: {
753+
packages = final.lib.listToAttrs (map (p: {
754+
name = to-key p;
755+
value.components = final.lib.optionalAttrs (config.packages ? ${p.pkg-name}) (
756+
builtins.mapAttrs (_: x: builtins.mapAttrs (_: x: final.lib.mkOverride 990 x)
757+
(builtins.removeAttrs x ["buildable" "planned" "depends" "build-tools"]))
758+
(final.lib.filterAttrs (_: x: x != null) config.packages.${p.pkg-name}.components)
759+
);
760+
}) (final.lib.filter (p: to-key p != p.pkg-name) plan-json.install-plan));
761+
})
752762
({lib, ...}: {
753763
packages = final.lib.listToAttrs (map (p:
754764
let components =

0 commit comments

Comments
 (0)