From e7eb269d455d7afa0fd7abb211036f721b7afc78 Mon Sep 17 00:00:00 2001
From: Michael Alan Dorman <mdorman@ironicdesign.com>
Date: Fri, 27 Sep 2019 08:17:09 +0300
Subject: [PATCH] cabal2nix: fix build

Without this change, the build fails with:

```
Warning:
    This package indirectly depends on multiple versions of the same package. This is very likely to cause a compile failure.
      package hackage-db (hackage-db-2.0.1-AliTRXEJBGFAEMpONOEnbV) requires Cabal-2.4.0.1
      package hpack (hpack-0.32.0-1iJuukTWmC4EGkYhAiFeII) requires Cabal-3.0.0.0-CD1INMNwoxXIKVgcu1nec5
      package distribution-nixpkgs (distribution-nixpkgs-1.3.1-82Z2DCdLAUs8Q2gjtlPLz5) requires Cabal-3.0.0.0-CD1INMNwoxXIKVgcu1nec5
      package cabal2nix (cabal2nix-2.15.0) requires Cabal-3.0.0.0-CD1INMNwoxXIKVgcu1nec5
      package cabal2nix (cabal2nix-2.15.0) requires Cabal-3.0.0.0-CD1INMNwoxXIKVgcu1nec5
      package cabal2nix (cabal2nix-2.15.0) requires Cabal-3.0.0.0-CD1INMNwoxXIKVgcu1nec5
```
---
 .../haskell-modules/configuration-ghc-8.6.x.nix           | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
index 455b2358da77..41b6177efef6 100644
--- a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
+++ b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
@@ -95,7 +95,11 @@ self: super: {
   # Newer versions don't compile.
   resolv = self.resolv_0_1_1_2;
 
-  # cabal2nix needs the latest version of Cabal.
-  cabal2nix = super.cabal2nix.overrideScope (self: super: { Cabal = self.Cabal_3_0_0_0; });
+  # cabal2nix needs the latest version of Cabal, and the one
+  # hackage-db uses must match, so take the latest
+  cabal2nix = super.cabal2nix.overrideScope (self: super: {
+    Cabal = self.Cabal_3_0_0_0;
+    hackage-db = self.hackage-db_2_1_0;
+  });
 
 }