@@ -13,49 +13,22 @@ with haskellLib;
13 "benchmarks"
13 "benchmarks"
16− mergeComponents = lib.zipAttrsWith (_: comps: lib.genAttrs [
23− ${n} = lib.concatMap (comp: comp.${n} or []) comps;
26− unionrAttrs = lib.foldr (a: b: a // b) {};
28− mergeConfigs = configs:
30− mergeComponentType = type: mergeComponents (map (conf: (conf.components or {}).${type} or {}) configs);
31− in unionrAttrs configs // {
32− flags = unionrAttrs (map (conf: conf.flags or {}) configs);
33− package = lib.foldr (conf: lib.recursiveUpdate (conf.package or {})) {} configs;
35− mergeComponents (map (conf: removeAttrs (conf.components or {}) subComponentTypes) configs)
36− // lib.genAttrs subComponentTypes mergeComponentType;
37− configureFlags = concatMap (conf: conf.configureFlags or []) configs;
40 foldrAttrVals = f: z: attrs:
16 foldrAttrVals = f: z: attrs:
41− lib.foldr (g: acc: g acc) z (lib.mapAttrsToList f attrs);
17+ lib.foldr (g: acc: g acc) z (lib.mapAttrsToList (_name: f) attrs);
43− attrLength = attrs: builtins.length (builtins.attrValues attrs);
45 foldComponents = tys: f: z: conf:
19 foldComponents = tys: f: z: conf:
47 comps = conf.components or {};
21 comps = conf.components or {};
48− foldSection = foldrAttrVals f;
22+ libComp = acc: if comps ? library then f comps.library acc else acc;
51− (removeAttrs comps subComponentTypes);
52 subComps = acc:
23 subComps = acc:
54− (ty: acc': foldSection acc' (comps.${ty} or {}))
25+ (ty: acc': foldrAttrVals f acc' (comps.${ty} or {}))
57 in libComp (subComps z);
28 in libComp (subComps z);
30+ getAllComponents = foldComponents subComponentTypes (c: acc: [c] ++ acc) [];
59 componentPrefix = {
32 componentPrefix = {
60 # Are all of these right?
33 # Are all of these right?
61 sublibs = "sublib";
34 sublibs = "sublib";