-
Notifications
You must be signed in to change notification settings - Fork 3
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
Non-haskell dependencies #7
Comments
This gist is important as well: https://gist.github.com/CMCDragonkai/8b5cc041cea4a7e45a9cb89f849eaaf8 Especially if you're doing separate compilation of C files using just |
For non-haskell dependencies that are libraries. Apparently the proper way is to put down in
This will put the dependency into It also automatically makes |
Ok I found the problem: NixOS/cabal2nix#413 Basically Cabal/Hpack expects that So if you state But if we change to So what does cabal2nix do? It maintains a mapping of common library names to the package names in Nixpkgs. This means we have to request them to maintain these mappings everytime we meet a dependency that isn't mapped already. However... as a stop-gap, we can fill in these mappings ourselves when we load the
BTW, Nix puts these C dependencies in However this doesn't solve the problem for things like |
Do note if using the callPackage pattern, you need to make sure to overwrite the parameter in default.nix to be a top level package, if there are name conflicts between the top level package name and another haskell package name. |
The #24 takes over from #23. #23 shows an example of how to use CPP to put compile time macros into the Haskell program. So I'm going to close that one, but it is still useful reference for everybody in case they need a compile time macro. @DrFacepalm @nzhang-zh @Zachaccino |
Solved this for Haskell Demo. But in general there is 2 solutions: A. You consider project to be a Haskell dependency (something distributed on hackage) In the A side, you must keep In the B side, you can dispense with that requirement, make B may be relevant if there's a lot of non-Haskell stuff, a multi-language and many dependency project. If you are doing B, you will end up using the |
The proper way to bring in non-haskell dependencies when using
cabal2nix
is to again usepackage.yaml
. This means we don't add dependencies directly into thedefault.nix
.For example to bring in
clang
. We need to add it to thebuild-tools
orsystem-build-tools
in thepackage.yaml
.Note that
system-build-tools
is what it should be at the latest version ofhpack
. On older versions it'sbuild-tools
. The change was added here: sol/hpack@c1d4ba7 This can be added like:Then you update the
cabal.nix
and also the cabal file usingcabal2nix
andhpack
. And then you should seeclang
appear in both the buildInputs ofdefault.nix
andshell.nix
.The text was updated successfully, but these errors were encountered: