3
0
Fork 0
forked from mirrors/nixpkgs

Extract files one at a time from all-cabal-hashes

This commit is contained in:
Will Fancher 2017-11-06 16:26:05 -05:00
parent 8caf9f13a6
commit a38a3e2129
2 changed files with 13 additions and 12 deletions

View file

@ -1,11 +1,6 @@
{ fetchFromGitHub }:
{ fetchurl }:
# Use builtins.fetchTarball "https://github.com/commercialhaskell/all-cabal-hashes/archive/hackage.tar.gz"
# instead if you want the latest Hackage automatically at the price of frequent re-downloads.
fetchFromGitHub {
owner = "commercialhaskell";
repo = "all-cabal-hashes";
rev = "5e87c40f2cd96bd5dd953758e82f302107c7895e";
sha256 = "12rw5fld64s0a2zjsdijfs0dv6vc6z7gcf24h4m2dmymzms4namg";
fetchurl {
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/5e87c40f2cd96bd5dd953758e82f302107c7895e.tar.gz";
sha256 = "0hjkddda9mdm21nb9bkhr9n5r9jllisif1qmzha91a9cps5w1mx5";
}

View file

@ -118,10 +118,16 @@ let
'';
};
hackage2nix = name: version: self.haskellSrc2nix {
all-cabal-hashes-component = name: version: pkgs.runCommand "all-cabal-hashes-component-${name}-${version}" {} ''
tar --wildcards -xzvf ${all-cabal-hashes} \*/${name}/${version}/${name}.{json,cabal}
mkdir -p $out
mv */${name}/${version}/${name}.{json,cabal} $out
'';
hackage2nix = name: version: let component = all-cabal-hashes-component name version; 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}.json")'';
src = "${component}/${name}.cabal";
};
in package-set { inherit pkgs stdenv callPackage; } self // {