blob: b3cf3cdca2fcd18fbe64eda47ebd080914887ffd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* A set of aliases to be used in generated expressions.
In case of ambiguity, this will pick a sensible default.
This was initially based on cabal2nix's mapping.
It'd be nice to generate this mapping, based on a set of derivations.
It can not be fully automated, so it should be a expression or tool
that makes suggestions about which pkg-config module names can be added.
*/
pkgs:
let
inherit (pkgs) lib;
inherit (lib)
all
flip
mapAttrs
mapAttrsToList
getAttrFromPath
importJSON
;
data = importJSON ./pkg-config-data.json;
inherit (data) modules;
platform = pkgs.stdenv.hostPlatform;
isSupported = moduleData:
moduleData?supportedWhenPlatformAttrsEqual ->
all (x: x) (
mapAttrsToList
(k: v: platform?${k} && platform.${k} == v)
moduleData.supportedWhenPlatformAttrsEqual
);
modulePkgs = flip mapAttrs modules (_moduleName: moduleData:
if moduleData?attrPath && isSupported moduleData then
getAttrFromPath moduleData.attrPath pkgs
else
null
);
in
modulePkgs
|