14 mergeComponents = lib.zipAttrsWith (_: comps: lib.genAttrs [
21 ${n} = lib.concatMap (comp: comp.${n} or []) comps;
24 unionrAttrs = lib.foldr (a: b: a // b) {};
26 mergeConfigs = configs:
28 mergeComponentType = type: mergeComponents (map (conf: (conf.components or {}).${type} or {}) configs);
29 in unionrAttrs configs // {
30 flags = unionrAttrs (map (conf: conf.flags or {}) configs);
31 package = lib.foldr (conf: lib.recursiveUpdate (conf.package or {})) {} configs;
33 mergeComponents (map (conf: removeAttrs (conf.components or {}) subComponentTypes) configs)
34 // lib.genAttrs subComponentTypes mergeComponentType;
35 configureFlags = concatMap (conf: conf.configureFlags or []) configs;
38 foldrAttrVals = f: z: attrs:
39 lib.foldr (g: acc: g acc) z (lib.mapAttrsToList f attrs);
41 attrLength = attrs: builtins.length (builtins.attrValues attrs);
43 foldComponents = tys: f: z: conf:
45 comps = conf.components or {};
46 foldSection = foldrAttrVals f;
49 (removeAttrs comps subComponentTypes);
52 (ty: acc': foldSection acc' (comps.${ty} or {}))
55 in libComp (subComps z);
58 # Are all of these right?
60 foreignlibs = "foreignlib";
66 applyComponents = f: config:
68 comps = config.components;
69 libComp = lib.mapAttrs (cname: f {ctype="lib"; cname=config.package.identifier.name;}) (removeAttrs comps subComponentTypes);
70 subComps = lib.mapAttrs
71 (ctype: lib.mapAttrs (cname: f {inherit cname; ctype=componentPrefix.${ctype};}))
72 (builtins.intersectAttrs (lib.genAttrs subComponentTypes (_: null)) comps);
73 in subComps // libComp;
75 isLibrary = componentId: componentId.ctype == "lib";
77 # Avoid pkgs.callPackage for now. It does a lot of nonsense with OOP
78 # style programming that we should avoid until we know we want it.
80 # weakCallPackage: call a function or (importable expression)
83 # weakCallPackage scope f args
84 # will call f (scope // args)
86 # weakCallpackage scope ./path args
87 # will call the expression at ./path with (scope // args)
89 weakCallPackage = scope: f: args:
90 let f' = if lib.isFunction f then f else import f;
91 args' = scope // args;
92 in f' (builtins.intersectAttrs (builtins.functionArgs f') args');
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list