Tl;dr example:
Jailbreak protolude to work with GHC910 from nixpkgs release-24.11
:
-overlay = final: prev: {
hshaskell = prev.haskell // {
packageOverrides = hfinal: hprev:
// {
prev.haskell.packageOverrides hfinal hprev ############################################################
## Packages that need fixing because of too-restrictive dependencies
## Specifically, base is version 4.20.0.1 for GHC910.
# Wants base >=4.6 && <4.20 and complains on "SafeHaskell" imports
protolude = final.lib.pipe hprev.protolude [
# lift version bounds on dependencies
final.haskell.lib.compose.doJailbreak(final.haskell.lib.compose.appendConfigureFlags
[ "--ghc-option=-fno-safe-haskell"
"--haddock-option=--optghc=-fno-safe-haskell"
]
)
];
Background and Explanation
I’ve been working on a flake for web development in Haskell, specifically to make use of Halogen Haskell.
The features that I need are only available in GHC 9.8+, and I’m working with
release-24.11
of nixpkgs. So I’ve gone with the latest GHC I have available,
which is 9.10. protolude
first needed a jailbreak to let it compile with
base-4.20.0.1
, and then subsequently failed with
error: builder for '/nix/store/rianjdyai6yi3h13lrdp767jgwpr0hdb-protolude-0.3.4.drv' failed with exit code 1;
last 25 log lines:
> GHC.Num: Can't be safely imported! The module itself isn't safe.
> |
> 38 | import GHC.Num ((-))
> | ^^^^^^^^^^^^^^^^^^^^
>
indicating that the Safe Haskell extension was causing grief.
A quick perusal of the nixpkgs haskell configuration indicates the correct syntax for enabling the GHC option (and the corresponding haddock option) to allow the build to proceed.
Hopefully this is useful to someone else. I’ll open-source the flake when it’s stabilized; give me a shout on matrix if I forget!