haskellPackages.tensorflow-mnist-input-data: fetch

Prefetch data so that the package doesn't try to connect to the internet.
This commit is contained in:
Matthieu Coudron 2018-09-06 00:11:02 +09:00
parent ba52f4cb76
commit 11e2009821

View File

@ -62,6 +62,30 @@ in
{ mkDerivation, base, bytestring, Cabal, cryptonite, directory
, filepath, HTTP, network-uri, stdenv
}:
let
urlPrefix = "http://yann.lecun.com/exdb/mnist/";
# File names relative to 'urlPrefix' and their sha256.
fileInfos = [
[ "train-images-idx3-ubyte.gz"
"440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609"
]
[ "train-labels-idx1-ubyte.gz"
"3552534a0a558bbed6aed32b30c495cca23d567ec52cac8be1a0730e8010255c"
]
[ "t10k-images-idx3-ubyte.gz"
"8d422c7b0a1c1c79245a5bcf07fe86e33eeafee792b84584aec276f5a2dbc4e6"
]
[ "t10k-labels-idx1-ubyte.gz"
"f7ae60f92e00ec6debd23a6088c31dbd2371eca3ffa0defaefb259924204aec6"
]
];
downloads = map (x: pkgs.fetchurl { url = urlPrefix + builtins.head x; sha256= builtins.tail x;}) fileInfos;
in
mkDerivation {
pname = "tensorflow-mnist-input-data";
version = "0.1.0.0";
@ -71,6 +95,9 @@ in
base bytestring Cabal cryptonite directory filepath HTTP
network-uri
];
preConfigure = pkgs.lib.strings.concatStringsSep "\n" (
map (x: "cp ${x} data/$(stripHash ${x})") downloads
);
libraryHaskellDepends = [ base ];
homepage = "https://github.com/tensorflow/haskell#readme";
description = "Downloader of input data for training MNIST";