Package Settings

Settings for individual Haskell packages can be specified in the settings attribute of a haskellProjects module.

haskellProjects.default = {
  settings = {
    ema = {  # This module can take `{self, super, ...}` args, optionally.
      # Disable running tests
      check = false;

      # Disable building haddock (documentation)
      haddock = false;

      # Ignore Cabal version constraints
      jailbreak = true;

      # Extra non-Haskell dependencies
      extraBuildDepends = [ pkgs.stork ];

      # Source patches
      patches = [ ./patches/ema-bug-fix.patch ];

      # Enable/disable Cabal flags
      cabalFlags.with-generics = true;

      # Allow building a package marked as "broken"
      broken = false;
    };
  };
};
Note

nixpkgs functions

  • The pkgs.haskell.lib module provides various utility functions that you can use to override Haskell packages. The canonical place to find documentation on these is the source. haskell-flake provides a settings submodule for convenience. For eg., the dontCheck function translates to settings.<name>.check; the full list of options can be seen here.

Sharing package settings

Project modules export both packages and settings options for reuse in downstream Haskell projects.

Custom settings

You can provide custom settings for use in multiple packages (even across multiple repos). For example, see this Emanote change which demonstrates how to add a new setting option (removeReferencesTo).

Extra settings

haskell-flake provides the following settings on top of those provided by nixpkgs.

removeReferencesTo

Remove references to other packages from this Haskell package. This is useful to eliminate unnecessary data dependencies from your Haskell executable so as to reduce its closure size.

buildFromSdist

Newer versions of nixpkgs provide buildFromSdist to build your package from the cabal sdist tarball. This is enabled by default, to help with checking release-worthiness of your packages.

Issues with buildFromSdist

If you encounter issues with buildFromSdist you can disable it by setting settings.<name>.buildFromSdist to true.

Links to this page