3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/top-level/pkg-config-packages.nix
Robert Hensing 81a541e6b6 defaultPkgConfigPackages: Make it JSON
With a bit of help from:

```
nix-repl> :b (formats.json {}).generate "hi" { modules = lib.mapAttrs (k: v: { attrPath = v; }) (p (paths [] pkgs // { stdenv = { isDarwin = false; isLinux = false; };})); }
```
2023-01-29 09:51:55 +01:00

47 lines
1.4 KiB
Nix

/* 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)
flip
mapAttrs
getAttrFromPath
importJSON
;
result = modulePkgs // overrides;
data = importJSON ./pkg-config/pkg-config-data.json;
inherit (data) modules;
modulePkgs = flip mapAttrs modules (_moduleName: moduleData:
if moduleData?attrPath then
getAttrFromPath moduleData.attrPath pkgs
else
null
);
overrides = {
hidapi = if pkgs.stdenv.isDarwin then pkgs.hidapi else null;
hidapi-hidraw = if pkgs.stdenv.isDarwin then null else pkgs.hidapi;
hidapi-libusb = if pkgs.stdenv.isDarwin then null else pkgs.hidapi;
libpulse-mainloop-glib = if pkgs.stdenv.isDarwin then null else pkgs.libpulseaudio;
wayland-client = if pkgs.stdenv.isDarwin then null else pkgs.wayland;
wayland-cursor = if pkgs.stdenv.isDarwin then null else pkgs.wayland;
egl = if pkgs.stdenv.isDarwin then null else pkgs.libGL;
wayland-server = if pkgs.stdenv.isDarwin then null else pkgs.wayland;
};
in
result