Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskell-nix.extraPkgconfigMappings #1667

Merged
merged 1 commit into from
Sep 14, 2022

Conversation

ramirez7
Copy link
Contributor

@ramirez7 ramirez7 commented Sep 13, 2022

Fixes #1664

You can try the sdl-gpu-minimal example here https://gitlab.com/macaroni.dev/macaroni.nix/-/merge_requests/12

It maps multiple new libraries and works on Linux and Windows (see #1666 for a change I had to make) currently.

@@ -11,6 +11,8 @@ final: prev: {
# overlays.
defaultModules = [];

# TODO: doc etc
extraPkgconfigMappings = {};
Copy link
Contributor Author

@ramirez7 ramirez7 Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought making this an attribute of haskell-nix and leveraging overlays would be the most composable route to propagating this to where it needed to go (similar to defaultModules).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be part of the project-common module.

@ramirez7 ramirez7 changed the title WIP: haskell-nix.extraPkgconfigMappings haskell-nix.extraPkgconfigMappings Sep 13, 2022
@hamishmack
Copy link
Collaborator

I'm wondering if a better fix might be to just add these packages (SDL_gpu and SDL_FontCache) to the mapping in haskell.nix.

It used to be that there was an implicit mapping for all packages where the names matched (as is the case here).

We had to loose that mapping with the new dummy pkg-config because some packages in nixpkgs blow up eval if you even look for a .version (there is no way to know which packages these will be for all nixpkgs so we can't have a black list).

I'll merge this feature though because there is a use case where multiple nixpkgs packages all provide the same pkg-config package. This will let us override the default without having to resort to replacing it in pkgs.

It might also be useful to have a way to exclude things from the mapping for example if:

  • The version of nixpkgs in use does not have a .pc file yet.
  • We don't want cabal to use a certain pkg-config package in its plan.

@hamishmack
Copy link
Collaborator

bors try

iohk-bors bot added a commit that referenced this pull request Sep 14, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 14, 2022

@ramirez7
Copy link
Contributor Author

I'm wondering if a better fix might be to just add these packages (SDL_gpu and SDL_FontCache) to the mapping in haskell.nix.

Neither library emits a .pc file upstream, so they only work for me because I have Nix packaging to explicitly emit a .pc file. So if/when I upstream that logic to nixpkgs or to the libraries themselves, I will be sure to send a PR to haskell.nix with the official mapping.

But for now, I'll continue to use this. In general, users will likely run into unpackaged C libraries they wish to package themselves with pkgconfig to take advantage of the infrastructure around it in cabal + haskell.nix. So this feature is definitely useful regardless!

@hamishmack hamishmack merged commit 49c4aa4 into input-output-hk:master Sep 14, 2022
@yvan-sraka
Copy link
Contributor

Should we document that directly on the https://input-output-hk.github.io/haskell.nix/ manual?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to add pkgconfig packages without forking haskell.nix
4 participants