about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2018-09-06 00:11:02 +0900
committerMatthieu Coudron <mattator@gmail.com>2018-09-06 00:11:02 +0900
commit11e2009821decf55aa20589447076aab5f998464 (patch)
treec5bb111f91ef7415e9df650545200076f69a3b18 /pkgs/development/haskell-modules
parentba52f4cb76cbc8cc877077bd19c1ab3811c244e6 (diff)
downloadnixlib-11e2009821decf55aa20589447076aab5f998464.tar
nixlib-11e2009821decf55aa20589447076aab5f998464.tar.gz
nixlib-11e2009821decf55aa20589447076aab5f998464.tar.bz2
nixlib-11e2009821decf55aa20589447076aab5f998464.tar.lz
nixlib-11e2009821decf55aa20589447076aab5f998464.tar.xz
nixlib-11e2009821decf55aa20589447076aab5f998464.tar.zst
nixlib-11e2009821decf55aa20589447076aab5f998464.zip
haskellPackages.tensorflow-mnist-input-data: fetch
Prefetch data so that the package doesn't try to connect to the internet.
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/configuration-tensorflow.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix
index dfc93686405c..d1ca474ba4f4 100644
--- a/pkgs/development/haskell-modules/configuration-tensorflow.nix
+++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix
@@ -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";