Closed Ericson2314 closed 1 year ago
CC @hamishmack and @sternenseemann, as I imagine both Haskell infrastructures have a pretty good list initial list we could use to get started on this.
We have a lookup table, but it is very aggressive: It maps names to nixpkgs attribute paths, but those names may either be the name you'd pass to pkg-config
or the name you'd pass to the linker via -l
. Consequently, the data would need quite a bit of manual cleaning up. For the curious libNixName
in Distribution.Nixpkgs.Haskell.FromCabal.Name
in cabal2nix
'
nix-index can be used to find all the pc files
nix-locate --regex --top-level '/lib/pkgconfig/.*.pc'
The output format is
abseil-cpp.out 502 r /nix/store/wsi5wc7qhmix5f6aiz6p1yyhnhcwrdrp-abseil-cpp-20210324.2/lib/pkgconfig/absl_wyhash.pc
@Ericson2314 pinged me because of our work on Riff.sh. We looked at doing something similar back in September, but never took steps on it. Maybe this is useful info:
Investigate indexing pkg-config files
go.mod allows listing pkg-config packages
cgo directives also allow listing pkg-config packages
It would be useful to be able to look up nix packages by pkg-config name.
We could probably generate an index mapping pkg-config package names to nixpkgs attr names from a nix-index database, and plonk that into the registry. See how feasible this is, how much data comes out, etc.
We were planning on doing it through something like nix-index instead of adding metadata preemptively to Nixpkgs. But I think either way could work.
And I was totally unaware that Go leverages this too! Good to see more newer languages going with pkg-config out of the box.
That is merged so this is done! Just need to go annotate all the packages now :)
Issue description
The world really needs to know which distro package provides which pkg-config package. This is important because pkg-config package names are the defacto way to refer to C / "foreign" libraries in a distro-agnostic way, and we generally want upstream package managers to use them vs more ad-hoc methods.
This would be really good for upstream language-based tools, our lang2nix tools, really everybody.
In https://github.com/repology/repology-updater/issues/1309, the Repology maintainer @AMDmi3 has kindly offered:
That sounds amazing!
Goal
We should have
meta.pkg-config
field, which is either a single string or list of strings.pc
file.CC @dcbaker