summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2017-10-15 18:13:29 -0400
committerShea Levy <shea@shealevy.com>2017-10-15 18:13:29 -0400
commitad6b8f438db055a73e64218b5f2ed3cbca963ae5 (patch)
treed6d8163848c619e4a284e32c00ab8a0faab86f06 /pkgs/development
parent2d44e7280166256d8322546b11dcbe9b95f5bc5d (diff)
parent3ef3fc43a22f53cf2c00b9994569c28a83898829 (diff)
downloadnixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar.gz
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar.bz2
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar.lz
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar.xz
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.tar.zst
nixlib-ad6b8f438db055a73e64218b5f2ed3cbca963ae5.zip
Merge branch 'all-cabal-hashes-components'
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/haskell-modules/make-package-set.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix
index ff5be894b926..d84167008d93 100644
--- a/pkgs/development/haskell-modules/make-package-set.nix
+++ b/pkgs/development/haskell-modules/make-package-set.nix
@@ -118,10 +118,23 @@ let
       '';
   };
 
-  hackage2nix = name: version: self.haskellSrc2nix {
+  all-cabal-hashes-component = name: import (pkgs.runCommand "all-cabal-hashes-component-${name}.nix" {}
+    ''
+      set +o pipefail
+      for component in ${all-cabal-hashes}/*; do
+        if ls $component | grep -q ${name}; then
+          echo "builtins.storePath $component" > $out
+          exit 0
+        fi
+      done
+      echo "${name} not found in any all-cabal-hashes component, are you sure it's in hackage?" >&2
+      exit 1
+    '');
+
+  hackage2nix = name: version: let component = all-cabal-hashes-component name; in self.haskellSrc2nix {
     name   = "${name}-${version}";
-    sha256 = ''$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' "${all-cabal-hashes}/${name}/${version}/${name}.json")'';
-    src    = "${all-cabal-hashes}/${name}/${version}/${name}.cabal";
+    sha256 = ''$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' "${component}/${name}/${version}/${name}.json")'';
+    src    = "${component}/${name}/${version}/${name}.cabal";
   };
 
 in package-set { inherit pkgs stdenv callPackage; } self // {