summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/haskell-modules/lib.nix23
1 files changed, 21 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index a4db98f2e618..b92bf304723b 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -85,6 +85,25 @@ rec {
 
   triggerRebuild = drv: i: overrideCabal drv (drv: { postUnpack = ": trigger rebuild ${toString i}"; });
 
-  #FIXME: throw this away sometime in the future. added 2015-08-18
-  withHoogle = throw "withHoogle is no longer supported, use ghcWithHoogle instead";
+  allCabalFiles = pkgs.fetchFromGitHub {
+     owner = "commercialhaskell";
+     repo = "all-cabal-hashes";
+     rev = "461610ab6f0cf581e186643c037f1981755792d9";
+     sha256 = "0x2577lfd5cbbaivl72273kw93gcmxvbjybk7w4h2ic3zvs1fnvm";
+   };
+
+   hackage2nix = name: version: pkgs.stdenv.mkDerivation {
+     name = "cabal2nix-${name}-${version}";
+     buildInputs = [ pkgs.cabal2nix ];
+     phases = ["installPhase"];
+     LANG = "en_US.UTF-8";
+     LOCALE_ARCHIVE = pkgs.lib.optionalString pkgs.stdenv.isLinux "${pkgs.glibcLocales}/lib/locale/locale-archive";
+     installPhase = ''
+       export HOME="$TMP"
+       mkdir $out
+       hash=$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' ${allCabalFiles}/${name}/${version}/${name}.json)
+       cabal2nix --sha256=$hash ${allCabalFiles}/${name}/${version}/${name}.cabal >$out/default.nix
+     '';
+   };
+
 }