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

How to set ghc-options for whole package set? #871

Closed
phile314 opened this issue Oct 8, 2020 · 3 comments
Closed

How to set ghc-options for whole package set? #871

phile314 opened this issue Oct 8, 2020 · 3 comments

Comments

@phile314
Copy link

phile314 commented Oct 8, 2020

For our production deployment, we would like to compile all packages with -O2. As far as I can see, the ghcOptions ( https://input-output-hk.github.io/haskell.nix/reference/modules/#packagespackageghcoptions ) can only be set per-package. Is there an easy way to compile a complete package set with -O2?

@phile314 phile314 changed the title How to set ghc-options for whole package set How to set ghc-options for whole package set? Oct 8, 2020
@michaelpj
Copy link
Collaborator

Am I right that you only want to do this sometimes, i.e. it wouldn't be sufficient to add:

package *
    optimization: 2

to your cabal.project? I think that would have the effect of setting it up, but I get the impression you want to do this on the Nix side?

Independently, I agree that it would be nice to be able to set ghcOptions as a top-level option.

@phile314
Copy link
Author

phile314 commented Oct 8, 2020

Thanks for the quick reply!

Yes, I would prefer to do this on the nix side. For development we use stack build and as build times are already slow, we don't want -O2 there. For production on the other hand we don't care if builds take a few minutes longer and want to enable this for everything. By everything I also mean packages from stackage etc., e.g. aeson. Not sure if it should also apply to the libraries bundled with GHC.

For context, we are using callStackToNix to compute the nix build from our stack files.

@michaelpj
Copy link
Collaborator

Fixed by #1046

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

No branches or pull requests

2 participants