drv-parts icon indicating copy to clipboard operation
drv-parts copied to clipboard

Idea: declare pkg-config dependencies but only override Nixpkgs-style package names

Open roberth opened this issue 2 years ago • 2 comments

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.

roberth avatar Jan 25 '23 16:01 roberth

What's the potential relationship of the map? 1:n? n:1?!?

blaggacao avatar Feb 01 '23 14:02 blaggacao

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.

roberth avatar Feb 01 '23 16:02 roberth