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 easily set -Werror only in the Nix build of things? #519

Open
michaelpj opened this issue Mar 26, 2020 · 2 comments
Open

How to easily set -Werror only in the Nix build of things? #519

michaelpj opened this issue Mar 26, 2020 · 2 comments
Labels
preserved Keep stale bot away

Comments

@michaelpj
Copy link
Collaborator

A common desire is to set -Werror in CI/production builds but not in development builds.

It's not clear how to do this best in haskell.nix. Options that I can see:

  1. Put package a: ghc-options: -Werror in your cabal.project for all your local packages. (Can't do it globally because that affects dependencies: ghc-options applies to all dependencies, not just local packages haskell/cabal#3883). Provide a cabal.project.local that overrides this and gets rid of the flag.
    • Note: I haven't tried this, it might not work.
  2. Put the same in cabal.project.somethingelse, somehow get haskell.nix to include it?
  3. Put ghc-options: -Werror in all your .cabal files, guarded by a flag. Set this flag for all packages with module options.
    • Doesn't seem to be a way to do this globally? So I think you still have to set an option for every package in turn.
  4. Set the ghcOptions module option to -Werror for all your packages.

At the moment I'm using option 4., but it's somewhat painful due to having to manually list all your packages. Both 3. and 4. would be eased if there was an easy way to set a module option for all the project packages in one go. Maybe there's a clever way to use the module system to do this?

michaelpj added a commit to michaelpj/plutus that referenced this issue Mar 26, 2020
This proves somewhat annoying, unfortunately. See
input-output-hk/haskell.nix#519 for details.
michaelpj added a commit to IntersectMBO/plutus that referenced this issue Mar 26, 2020
This proves somewhat annoying, unfortunately. See
input-output-hk/haskell.nix#519 for details.
@cdepillabout
Copy link
Contributor

Both 3. and 4. would be eased if there was an easy way to set a module option for all the project packages in one go

We'd like this ability as well.

This was sort of discussed in the following issue: #298

@NorfairKing
Copy link

+1 I also want this as a stack user because I use the non --pedantic build while developing so I don't need to fix all my redundant imports during development.

@hamishmack hamishmack added the preserved Keep stale bot away label Sep 28, 2022
kayvank pushed a commit to input-output-hk/marconi that referenced this issue Mar 11, 2023
This proves somewhat annoying, unfortunately. See
input-output-hk/haskell.nix#519 for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preserved Keep stale bot away
Projects
None yet
Development

No branches or pull requests

4 participants