drv-parts
drv-parts copied to clipboard
Idea: declare pkg-config dependencies but only override Nixpkgs-style package names
Context
- https://github.com/NixOS/nixpkgs/pull/212282
- https://github.com/NixOS/cabal2nix/issues/594#issuecomment-1403896453
If we have a (json) mapping from pkg-config names to package attribute names, a module could easily add the appropriate deps
, without sacrificing the consistency with Nixpkgs-style names when it comes to overriding.
Without a special integration for the mapping, it'd be hard to override things, because pkg-config names ("modules") don't map 1:1 to package attribute names; not even in quantity. For example, to override nix
in a program that links it, you'd have to override all of nix-expr
, nix-store
, nix-main
, and make sure not to miss a module if it grows a new one (it has). This is problem is hard to detect. hidapi
has different pkg-config names depending on the platform.
What's the potential relationship of the map? 1:n? n:1?!?
In reality, any number of package attributes can provide any number of pkg-config modules, but usually a default choice will suffice, which is why defaultPkgConfigPackages
exists, and why the format only supports a single package attribute per pkg-config module for the initial edition of the json.
The json can be extended with more fields and more complete information, and probably should, but I suggest to take one step at a time. The new or extended schema could be designed bottom up (https://github.com/NixOS/nixpkgs/issues/212290) but should take into account the package generation needs.