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;
};
};
};
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 asettings
submodule for convenience. For eg., thedontCheck
function translates tosettings.<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.
buildFromSdist
If you encounter issues with buildFromSdist
you can disable it by setting settings.<name>.buildFromSdist
to true
.
stan
Run STatic ANalysis on the package using stan and generate an HTML report. The report is created in the /nix/store
path alongside your package outputs.
This setting looks for a
.stan.toml
file in the root of the package source. See a sample .stan.toml configuration for reference.