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; };})); }
```
This commit is contained in:
Robert Hensing 2023-01-29 08:18:21 +01:00
parent a010129bf8
commit 81a541e6b6
2 changed files with 970 additions and 186 deletions

View file

@ -8,195 +8,39 @@
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: {
inherit (pkgs)
bzip2
freealut
libb2
libsass
taglib
zlib
pkgs:
let
inherit (pkgs) lib;
inherit (lib)
flip
mapAttrs
getAttrFromPath
importJSON
;
alsa = pkgs.alsa-lib;
alsa-topology = pkgs.alsa-lib;
"appindicator-0.1" = pkgs.libappindicator-gtk2;
"appindicator3-0.1" = pkgs.libappindicator-gtk3;
cairo-gobject = pkgs.cairo;
cairo-pdf = pkgs.cairo;
cairo-ps = pkgs.cairo;
cairo-svg = pkgs.cairo;
"ncurses++" = pkgs.ncurses;
"ncurses++w" = pkgs.ncurses;
form = pkgs.ncurses;
formw = pkgs.ncurses;
menu = pkgs.ncurses;
menuw = pkgs.ncurses;
ncurses = pkgs.ncurses;
ncursesw = pkgs.ncurses;
panel = pkgs.ncurses;
panelw = pkgs.ncurses;
result = modulePkgs // overrides;
"dbusmenu-glib-0.4" = pkgs.libdbusmenu;
"dbusmenu-gtk3-0.4" = pkgs.libdbusmenu-gtk3; # TODO: also needs gtk3. Use build propagation?
fftw3 = pkgs.fftw;
fftw3f = pkgs.fftwFloat;
freetype2 = pkgs.freetype;
"gdk-2.0" = pkgs.gtk2;
"gdk-3.0" = pkgs.gtk3;
"gdk-pixbuf-2.0" = pkgs.gdk-pixbuf;
"gdk-x11-2.0" = pkgs.gtk2-x11;
"gdk-x11-3.0" = pkgs.gtk3-x11;
geos = pkgs.geos;
"gio-2.0" = pkgs.glib;
gl = pkgs.libGL;
glew = pkgs.glew;
glu = pkgs.libGLU;
glut = pkgs.freeglut;
gnome-keyring-1 = pkgs.libgnome-keyring;
"gnome-vfs-2.0" = pkgs.gnome2.gnome_vfs;
"gnome-vfs-module-2.0" = pkgs.gnome2.gnome_vfs;
"gobject-2.0" = pkgs.glib;
"gobject-introspection-1.0" = pkgs.gobject-introspection;
"gstreamer-audio-1.0" = pkgs.gst_all_1.gst-plugins-base;
"gstreamer-base-1.0" = pkgs.gst_all_1.gst-plugins-base;
"gstreamer-controller-1.0" = pkgs.gst_all_1.gstreamer;
"gstreamer-net-1.0" = pkgs.gst_all_1.gst-plugins-base;
"gstreamer-video-1.0" = pkgs.gst_all_1.gst-plugins-base;
"gthread-2.0" = pkgs.glib;
"gtk+-2.0" = pkgs.gtk2;
"gtk+-3.0" = pkgs.gtk3;
"gtk+-x11-2.0" = pkgs.gtk2-x11;
"gtksourceview-3.0" = pkgs.gtksourceview3;
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;
icu-i18n = pkgs.icu;
icu-uc = pkgs.icu;
icu-io = pkgs.icu;
libidn = pkgs.libidn;
IL = pkgs.libdevil;
ImageMagick = pkgs.imagemagick;
imlib2 = pkgs.imlib2;
jack = pkgs.libjack2;
"javascriptcoregtk-4.0" = pkgs.webkitgtk;
libjpeg = pkgs.libjpeg;
libturbojpeg = pkgs.libjpeg;
lapack = pkgs.liblapack;
libavutil = pkgs.ffmpeg;
libbrotlienc = pkgs.brotli;
libbrotlidec = pkgs.brotli;
libgsasl = pkgs.gsasl;
libpcre = pkgs.pcre;
libpcre2-8 = pkgs.pcre2;
libpcre2-16 = pkgs.pcre2;
libpcre2-32 = pkgs.pcre2;
libpcre2-posix = pkgs.pcre2;
libqrencode = pkgs.qrencode;
libR = pkgs.R;
libsecp256k1 = pkgs.secp256k1;
"libsoup-gnome-2.4" = pkgs.libsoup;
libsystemd = pkgs.systemd;
libudev = pkgs.systemd;
"libxml-2.0" = pkgs.libxml2;
libzip = pkgs.libzip;
libzmq = pkgs.zeromq;
liblzma = pkgs.xz;
m = null; # in stdenv
libmagic = pkgs.file;
MagickWand = pkgs.imagemagick;
libmnl = pkgs.libmnl;
data = importJSON ./pkg-config/pkg-config-data.json;
inherit (data) modules;
ompi = pkgs.openmpi;
ompi-c = pkgs.openmpi;
ompi-cxx = pkgs.openmpi;
ompi-fort = pkgs.openmpi;
ompi-f77 = pkgs.openmpi;
ompi-f90 = pkgs.openmpi;
orte = pkgs.openmpi;
modulePkgs = flip mapAttrs modules (_moduleName: moduleData:
if moduleData?attrPath then
getAttrFromPath moduleData.attrPath pkgs
else
null
);
netsnmp = pkgs.net_snmp;
nix-cmd = pkgs.nix;
nix-expr = pkgs.nix;
nix-main = pkgs.nix;
nix-store = pkgs.nix;
libnotify = pkgs.libnotify;
odbc = pkgs.unixODBC;
openblas = pkgs.openblasCompat;
pangocairo = pkgs.pango;
libpcap = pkgs.libpcap;
libpng = pkgs.libpng;
poppler-glib = pkgs.poppler_gi;
libpq = pkgs.postgresql;
libpgtypes = pkgs.postgresql;
libecpg = pkgs.postgresql;
libecpg_compat = pkgs.postgresql;
pthread = null; # in stdenv
libpulse = pkgs.libpulseaudio;
libpulse-simple = pkgs.libpulseaudio;
libpulse-mainloop-glib = if pkgs.stdenv.isDarwin then null else pkgs.libpulseaudio;
python = pkgs.python3;
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;
};
Qt5Concurrent = pkgs.qt5.qtbase;
Qt5Core = pkgs.qt5.qtbase;
Qt5DBus = pkgs.qt5.qtbase;
Qt5Gui = pkgs.qt5.qtbase;
Qt5Network = pkgs.qt5.qtbase;
Qt5OpenGL = pkgs.qt5.qtbase;
Qt5OpenGLExtensions = pkgs.qt5.qtbase;
Qt5PrintSupport = pkgs.qt5.qtbase;
Qt5Sql = pkgs.qt5.qtbase;
Qt5Test = pkgs.qt5.qtbase;
Qt5Widgets = pkgs.qt5.qtbase;
Qt5Xml = pkgs.qt5.qtbase;
Qt5Qml = pkgs.qt5.qtdeclarative;
Qt5QmlModels = pkgs.qt5.qtdeclarative;
Qt5Quick = pkgs.qt5.qtdeclarative;
Qt5QuickTest = pkgs.qt5.qtdeclarative;
Qt5QuickWidgets = pkgs.qt5.qtdeclarative;
librtlsdr = pkgs.rtl-sdr;
"ruby-2.7" = pkgs.ruby_2_7;
"ruby-3.0" = pkgs.ruby_3_0;
"ruby-3.1" = pkgs.ruby_3_1;
libsctp = pkgs.lksctp-tools; # This is linux-specific, we should create a common attribute if we add sctp support for other systems.
sdl2 = pkgs.SDL2;
sndfile = pkgs.libsndfile;
SoapySDR = pkgs.soapysdr;
libsodium = pkgs.libsodium;
sqlite3 = pkgs.sqlite;
libssh2 = pkgs.libssh2;
openssl = pkgs.openssl;
libssl = pkgs.openssl;
libcrypto = pkgs.openssl;
libstatgrab = pkgs.libstatgrab;
taglib_c = pkgs.taglib;
tdjson = pkgs.tdlib;
tensorflow = pkgs.libtensorflow;
uuid = pkgs.libossp_uuid;
"vte-2.91" = pkgs.vte;
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-scanner = pkgs.wayland;
wayland-server = if pkgs.stdenv.isDarwin then null else pkgs.wayland;
"webkit2gtk-4.0" = pkgs.webkitgtk;
"webkit2gtk-web-extension-4.0" = pkgs.webkitgtk;
x11 = pkgs.xorg.libX11;
xau = pkgs.xorg.libXau;
xcursor = pkgs.xorg.libXcursor;
xerces-c = pkgs.xercesc;
xext = pkgs.xorg.libXext;
xft = pkgs.xorg.libXft;
xi = pkgs.xorg.libXi;
xinerama = pkgs.xorg.libXinerama;
xkbcommon = pkgs.libxkbcommon;
xpm = pkgs.xorg.libXpm;
xrandr = pkgs.xorg.libXrandr;
xrender = pkgs.xorg.libXrender;
xscrnsaver = pkgs.xorg.libXScrnSaver;
xtst = pkgs.xorg.libXtst;
xxf86vm = pkgs.xorg.libXxf86vm;
"yaml-0.1" = pkgs.libyaml;
}
in
result

View file

@ -0,0 +1,940 @@
{
"modules": {
"IL": {
"attrPath": [
"libdevil"
]
},
"ImageMagick": {
"attrPath": [
"imagemagick"
]
},
"MagickWand": {
"attrPath": [
"imagemagick"
]
},
"Qt5Concurrent": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Core": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5DBus": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Gui": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Network": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5OpenGL": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5OpenGLExtensions": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5PrintSupport": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Qml": {
"attrPath": [
"qt5",
"qtdeclarative"
]
},
"Qt5QmlModels": {
"attrPath": [
"qt5",
"qtdeclarative"
]
},
"Qt5Quick": {
"attrPath": [
"qt5",
"qtdeclarative"
]
},
"Qt5QuickTest": {
"attrPath": [
"qt5",
"qtdeclarative"
]
},
"Qt5QuickWidgets": {
"attrPath": [
"qt5",
"qtdeclarative"
]
},
"Qt5Sql": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Test": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Widgets": {
"attrPath": [
"qt5",
"qtbase"
]
},
"Qt5Xml": {
"attrPath": [
"qt5",
"qtbase"
]
},
"SoapySDR": {
"attrPath": [
"soapysdr"
]
},
"alsa": {
"attrPath": [
"alsa-lib"
]
},
"alsa-topology": {
"attrPath": [
"alsa-lib"
]
},
"appindicator-0.1": {
"attrPath": [
"libappindicator-gtk2"
]
},
"appindicator3-0.1": {
"attrPath": [
"libappindicator-gtk3"
]
},
"bzip2": {
"attrPath": [
"bzip2"
]
},
"cairo-gobject": {
"attrPath": [
"cairo"
]
},
"cairo-pdf": {
"attrPath": [
"cairo"
]
},
"cairo-ps": {
"attrPath": [
"cairo"
]
},
"cairo-svg": {
"attrPath": [
"cairo"
]
},
"dbusmenu-glib-0.4": {
"attrPath": [
"libdbusmenu"
]
},
"dbusmenu-gtk3-0.4": {
"attrPath": [
"libdbusmenu-gtk3"
]
},
"egl": {
"attrPath": [
"libGL"
]
},
"fftw3": {
"attrPath": [
"fftw"
]
},
"fftw3f": {
"attrPath": [
"fftwFloat"
]
},
"form": {
"attrPath": [
"ncurses"
]
},
"formw": {
"attrPath": [
"ncurses"
]
},
"freealut": {
"attrPath": [
"freealut"
]
},
"freetype2": {
"attrPath": [
"freetype"
]
},
"gdk-2.0": {
"attrPath": [
"gtk2"
]
},
"gdk-3.0": {
"attrPath": [
"gtk3"
]
},
"gdk-pixbuf-2.0": {
"attrPath": [
"gdk-pixbuf"
]
},
"gdk-x11-2.0": {
"attrPath": [
"gtk2-x11"
]
},
"gdk-x11-3.0": {
"attrPath": [
"gtk3-x11"
]
},
"geos": {
"attrPath": [
"geos"
]
},
"gio-2.0": {
"attrPath": [
"glib"
]
},
"gl": {
"attrPath": [
"libGL"
]
},
"glew": {
"attrPath": [
"glew"
]
},
"glu": {
"attrPath": [
"libGLU"
]
},
"glut": {
"attrPath": [
"freeglut"
]
},
"gnome-keyring-1": {
"attrPath": [
"libgnome-keyring"
]
},
"gnome-vfs-2.0": {
"attrPath": [
"gnome2",
"gnome_vfs"
]
},
"gnome-vfs-module-2.0": {
"attrPath": [
"gnome2",
"gnome_vfs"
]
},
"gobject-2.0": {
"attrPath": [
"glib"
]
},
"gobject-introspection-1.0": {
"attrPath": [
"gobject-introspection"
]
},
"gstreamer-audio-1.0": {
"attrPath": [
"gst_all_1",
"gst-plugins-base"
]
},
"gstreamer-base-1.0": {
"attrPath": [
"gst_all_1",
"gst-plugins-base"
]
},
"gstreamer-controller-1.0": {
"attrPath": [
"gst_all_1",
"gstreamer"
]
},
"gstreamer-net-1.0": {
"attrPath": [
"gst_all_1",
"gst-plugins-base"
]
},
"gstreamer-video-1.0": {
"attrPath": [
"gst_all_1",
"gst-plugins-base"
]
},
"gthread-2.0": {
"attrPath": [
"glib"
]
},
"gtk+-2.0": {
"attrPath": [
"gtk2"
]
},
"gtk+-3.0": {
"attrPath": [
"gtk3"
]
},
"gtk+-x11-2.0": {
"attrPath": [
"gtk2-x11"
]
},
"gtksourceview-3.0": {
"attrPath": [
"gtksourceview3"
]
},
"hidapi": {
"attrPath": null
},
"hidapi-hidraw": {
"attrPath": [
"hidapi"
]
},
"hidapi-libusb": {
"attrPath": [
"hidapi"
]
},
"icu-i18n": {
"attrPath": [
"icu"
]
},
"icu-io": {
"attrPath": [
"icu"
]
},
"icu-uc": {
"attrPath": [
"icu"
]
},
"imlib2": {
"attrPath": [
"imlib2"
]
},
"jack": {
"attrPath": [
"libjack2"
]
},
"javascriptcoregtk-4.0": {
"attrPath": [
"webkitgtk"
]
},
"lapack": {
"attrPath": [
"liblapack"
]
},
"libR": {
"attrPath": [
"R"
]
},
"libavutil": {
"attrPath": [
"ffmpeg"
]
},
"libb2": {
"attrPath": [
"libb2"
]
},
"libbrotlidec": {
"attrPath": [
"brotli"
]
},
"libbrotlienc": {
"attrPath": [
"brotli"
]
},
"libcrypto": {
"attrPath": [
"openssl"
]
},
"libecpg": {
"attrPath": [
"postgresql"
]
},
"libecpg_compat": {
"attrPath": [
"postgresql"
]
},
"libgsasl": {
"attrPath": [
"gsasl"
]
},
"libidn": {
"attrPath": [
"libidn"
]
},
"libjpeg": {
"attrPath": [
"libjpeg"
]
},
"liblzma": {
"attrPath": [
"xz"
]
},
"libmagic": {
"attrPath": [
"file"
]
},
"libmnl": {
"attrPath": [
"libmnl"
]
},
"libnotify": {
"attrPath": [
"libnotify"
]
},
"libpcap": {
"attrPath": [
"libpcap"
]
},
"libpcre": {
"attrPath": [
"pcre"
]
},
"libpcre2-16": {
"attrPath": [
"pcre2"
]
},
"libpcre2-32": {
"attrPath": [
"pcre2"
]
},
"libpcre2-8": {
"attrPath": [
"pcre2"
]
},
"libpcre2-posix": {
"attrPath": [
"pcre2"
]
},
"libpgtypes": {
"attrPath": [
"postgresql"
]
},
"libpng": {
"attrPath": [
"libpng"
]
},
"libpq": {
"attrPath": [
"postgresql"
]
},
"libpulse": {
"attrPath": [
"libpulseaudio"
]
},
"libpulse-mainloop-glib": {
"attrPath": [
"libpulseaudio"
]
},
"libpulse-simple": {
"attrPath": [
"libpulseaudio"
]
},
"libqrencode": {
"attrPath": [
"qrencode"
]
},
"librtlsdr": {
"attrPath": [
"rtl-sdr"
]
},
"libsass": {
"attrPath": [
"libsass"
]
},
"libsctp": {
"attrPath": [
"lksctp-tools"
]
},
"libsecp256k1": {
"attrPath": [
"secp256k1"
]
},
"libsodium": {
"attrPath": [
"libsodium"
]
},
"libsoup-gnome-2.4": {
"attrPath": [
"libsoup"
]
},
"libssh2": {
"attrPath": [
"libssh2"
]
},
"libssl": {
"attrPath": [
"openssl"
]
},
"libstatgrab": {
"attrPath": [
"libstatgrab"
]
},
"libsystemd": {
"attrPath": [
"systemd"
]
},
"libturbojpeg": {
"attrPath": [
"libjpeg"
]
},
"libudev": {
"attrPath": [
"systemd"
]
},
"libxml-2.0": {
"attrPath": [
"libxml2"
]
},
"libzip": {
"attrPath": [
"libzip"
]
},
"libzmq": {
"attrPath": [
"zeromq"
]
},
"m": {
"attrPath": null
},
"menu": {
"attrPath": [
"ncurses"
]
},
"menuw": {
"attrPath": [
"ncurses"
]
},
"ncurses": {
"attrPath": [
"ncurses"
]
},
"ncurses++": {
"attrPath": [
"ncurses"
]
},
"ncurses++w": {
"attrPath": [
"ncurses"
]
},
"ncursesw": {
"attrPath": [
"ncurses"
]
},
"netsnmp": {
"attrPath": [
"net_snmp"
]
},
"nix-cmd": {
"attrPath": [
"nix"
]
},
"nix-expr": {
"attrPath": [
"nix"
]
},
"nix-main": {
"attrPath": [
"nix"
]
},
"nix-store": {
"attrPath": [
"nix"
]
},
"odbc": {
"attrPath": [
"unixODBC"
]
},
"ompi": {
"attrPath": [
"openmpi"
]
},
"ompi-c": {
"attrPath": [
"openmpi"
]
},
"ompi-cxx": {
"attrPath": [
"openmpi"
]
},
"ompi-f77": {
"attrPath": [
"openmpi"
]
},
"ompi-f90": {
"attrPath": [
"openmpi"
]
},
"ompi-fort": {
"attrPath": [
"openmpi"
]
},
"openblas": {
"attrPath": [
"openblasCompat"
]
},
"openssl": {
"attrPath": [
"openssl"
]
},
"orte": {
"attrPath": [
"openmpi"
]
},
"panel": {
"attrPath": [
"ncurses"
]
},
"panelw": {
"attrPath": [
"ncurses"
]
},
"pangocairo": {
"attrPath": [
"pango"
]
},
"poppler-glib": {
"attrPath": [
"poppler_gi"
]
},
"pthread": {
"attrPath": null
},
"python": {
"attrPath": [
"python3"
]
},
"ruby-2.7": {
"attrPath": [
"ruby_2_7"
]
},
"ruby-3.0": {
"attrPath": [
"ruby_3_0"
]
},
"ruby-3.1": {
"attrPath": [
"ruby_3_1"
]
},
"sdl2": {
"attrPath": [
"SDL2"
]
},
"sndfile": {
"attrPath": [
"libsndfile"
]
},
"sqlite3": {
"attrPath": [
"sqlite"
]
},
"taglib": {
"attrPath": [
"taglib"
]
},
"taglib_c": {
"attrPath": [
"taglib"
]
},
"tdjson": {
"attrPath": [
"tdlib"
]
},
"tensorflow": {
"attrPath": [
"libtensorflow"
]
},
"uuid": {
"attrPath": [
"libossp_uuid"
]
},
"vte-2.91": {
"attrPath": [
"vte"
]
},
"wayland-client": {
"attrPath": [
"wayland"
]
},
"wayland-cursor": {
"attrPath": [
"wayland"
]
},
"wayland-scanner": {
"attrPath": [
"wayland"
]
},
"wayland-server": {
"attrPath": [
"wayland"
]
},
"webkit2gtk-4.0": {
"attrPath": [
"webkitgtk"
]
},
"webkit2gtk-web-extension-4.0": {
"attrPath": [
"webkitgtk"
]
},
"x11": {
"attrPath": [
"xorg",
"libX11"
]
},
"xau": {
"attrPath": [
"xorg",
"libXau"
]
},
"xcursor": {
"attrPath": [
"xorg",
"libXcursor"
]
},
"xerces-c": {
"attrPath": [
"xercesc"
]
},
"xext": {
"attrPath": [
"xorg",
"libXext"
]
},
"xft": {
"attrPath": [
"xorg",
"libXft"
]
},
"xi": {
"attrPath": [
"xorg",
"libXi"
]
},
"xinerama": {
"attrPath": [
"xorg",
"libXinerama"
]
},
"xkbcommon": {
"attrPath": [
"libxkbcommon"
]
},
"xpm": {
"attrPath": [
"xorg",
"libXpm"
]
},
"xrandr": {
"attrPath": [
"xorg",
"libXrandr"
]
},
"xrender": {
"attrPath": [
"xorg",
"libXrender"
]
},
"xscrnsaver": {
"attrPath": [
"xorg",
"libXScrnSaver"
]
},
"xtst": {
"attrPath": [
"xorg",
"libXtst"
]
},
"xxf86vm": {
"attrPath": [
"xorg",
"libXxf86vm"
]
},
"yaml-0.1": {
"attrPath": [
"libyaml"
]
},
"zlib": {
"attrPath": [
"zlib"
]
}
}
}