Support library-less cabal files.

This commit is contained in:
Moritz Angermann 2019-03-14 21:44:33 +08:00
parent 373ac25398
commit 696f22d87f
2 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,7 @@ with haskellLib;
applyLibrary = cname: f { cname = config.package.identifier.name; ctype = "lib"; };
applySubComp = ctype: cname: f { inherit cname; ctype = componentPrefix.${ctype}; };
applyAllComp = f { cname = config.package.identifier.name; ctype = "all"; };
libComp = lib.mapAttrs applyLibrary (removeAttrs comps (subComponentTypes ++ [ "all" ]));
libComp = if comps.library == null then {} else lib.mapAttrs applyLibrary (removeAttrs comps (subComponentTypes ++ [ "all" ]));
subComps = lib.mapAttrs
(ctype: lib.mapAttrs (applySubComp ctype))
(builtins.intersectAttrs (lib.genAttrs subComponentTypes (_: null)) comps);

View File

@ -160,7 +160,8 @@ in {
};
in {
library = mkOption {
type = componentType;
type = nullOr componentType;
default = null;
};
sublibs = mkOption {
type = attrsOf componentType;