cabal2nix icon indicating copy to clipboard operation
cabal2nix copied to clipboard

Get pkg-config dependencies from `pkg-configPackages`

Open roberth opened this issue 2 years ago • 5 comments

I wrote https://github.com/NixOS/nixpkgs/pull/212282 as a proposal to centralize this mapping in Nixpkgs. Do you think it is fit for the purpose of cabal2nix?

  • [ ] review https://github.com/NixOS/nixpkgs/pull/212282
  • [ ] change the generated code to use it

roberth avatar Jan 25 '23 12:01 roberth

In principle there is no reason why we can't use that for special pkg-config specific code in distribution-nixpkgs. This does, however, not mean that we can drop the libNixName code, since we also need to deal with the extra-libraries field and friends where lib$NAME is specified as would be passed to the linker via -l.

It is nice to have some of the ongoing maintenance in nixpkgs in any case, but I'm not sure if it makes stuff simpler in cabal2nix (but maybe that's just life).

sternenseemann avatar Jan 25 '23 14:01 sternenseemann

I suppose a similar libPackages may be a welcome addition then? It could follow the same pattern.

roberth avatar Jan 25 '23 15:01 roberth

I suppose a similar libPackages may be a welcome addition then? It could follow the same pattern.

Have my reservation about this idea, but I think it's a question we can revisit later.

sternenseemann avatar Jan 25 '23 16:01 sternenseemann

It does complicate the interface for overriding. Maybe it'd be better to consume a json, so that the overriding interface remains unchanged. That'd make the function parameters dynamic though, so it will look a bit messier in the generated code, with some setFunctionArgs wrappers that depend on the outcome of some lookups. Perhaps this idea is more appropriate for a far future iteration of Nixpkgs that uses module-style fixpoints instead of functions to define packages. I think that might be a better fit, but I'll stop speculating now.

roberth avatar Jan 25 '23 16:01 roberth

Passing in a JSON lookup table was going to be my answer anyways for RFC 109. The lookup table would be used at generation time though, no need to generate eval time lookups when we can already lookup at generation time.

sternenseemann avatar Jan 25 '23 18:01 sternenseemann