Is there an easy way to override a GHC core library when building a Haskell package?
For instance, the current GHC-8.6.5 package set uses bytestring-0.10.8.2
:
$ nix-shell -p haskell.compiler.ghc865
$ ghc-pkg list # within nix-shell
/nix/store/5adkvmak1j42pxpbhpjq33p16g0588a4-ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
...
bytestring-0.10.8.2
...
I’d like to build a Haskell package linking to bytestring-0.10.8.1
instead.
I came up with something like the following:
This seems relatively complicated. I’m wondering if there is an easier way to do this?
Here are two parts I don’t really like:
-
Having to pass a constraint to every package to force the version of
bytestring
I want, even if the package doesn’t use bytestring:Example of overriding a GHC core Haskell package with Nix · GitHub
I might be able to clean this up a little bit by checking if the package actually depends on
bytestring
, but it would be nice to completely handle this sort of thing in Nix code. Maybe doing something similar tostack
and hiding all packages by default, and only enabling those explicitly asked for by the user. -
Having to override all GHC core packages that use
bytestring
is annoying:Example of overriding a GHC core Haskell package with Nix · GitHub
I understand why this is needed, but it would be nice if something like this could happen automatically (somehow).
Maybe someone like @domenkozar, @peti, or @matthewbauer would have a good idea of an easier way to do this.