Disable cabal version check for some Haskell packages

It seems that lots of Haskell packages are broken due to upper bound on library versions, like mylib <= 1.2. However I’ve the feeling that most of the time there is no real reason to put that upper bound except “it has not yet been tested on newer versions”. While in Stack & co it may not be a problem since they seem to have several versions available for each library, in Nixpkgs there is only the last version of a library that is made available. Therefore, lots of packages don’t compile anymore just for that reason (I’ve right now an issue with Hakyll).

So here is my question: is it possible to easily patch a library, so that Cabal don’t do these version checks? For now I need to write a patch and it’s not really practical. Also any reason why Nixpkgs does not apply these kind of patch ? Indeed, packages that are really broken won’t compile anyway, and packages that are artificially broken would just work !


If I recall correctly haskell.lib.doJailbreak does exactly that. Avoiding version checks.

Though if it is not fixed that way, version bounds should be fixed by the maintainers of the tools, not by the maintainers of the nix eco system.

So, file a bug at hakyll…

To be honest, overly strict upper bounds seem to be quite a problem within the Haskell ecosystem…

1 Like

Great, thanks a lot! Unfortunately for my case it didn’t work, as the pandoc library is in a conditional branch of Cabal (Cabal can write some conditional branches to enable some libraries or not, here it tests if a flag usePandoc is enabled: If flag(usePandoc)). This is actually supposed to be a feature to avoid some bugs, I tried to ask for a way to force to lift the bounds on a package when the user explicitely provides a set of parameters.

And yes, I see that too strict upper bounds is usually a problem in the Haskell ecosystem, but they usually manage to limit these issues with resolvers… Unfortunately nix does not have such resolver, so it is even more a problem in Nix… I think it would be quite important for Nix to provide some ways to avoid these issues. Wouldn’t it make sense to keep for all packages all versions (they are anyway in the binary cache since it is not garbage collected), and automatically select the good version to include depending on the cabal file?