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:
https://gist.github.com/cdepillabout/a1b7226063f7aa57878059f9a3c638b4
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:https://gist.github.com/cdepillabout/a1b7226063f7aa57878059f9a3c638b4#file-example-nix-L25-L48
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:https://gist.github.com/cdepillabout/a1b7226063f7aa57878059f9a3c638b4#file-example-nix-L50-L60
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.