about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/configuration-tensorflow.nix
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-09-06 08:43:04 +0200
committerBas van Dijk <v.dijk.bas@gmail.com>2018-09-06 09:15:50 +0200
commit6bd8799448dd3d4a7f92f569202010e1fe5b9a33 (patch)
tree79914a0a26924cc2bbb5abf04c5a82c0fb3063f4 /pkgs/development/haskell-modules/configuration-tensorflow.nix
parent11e2009821decf55aa20589447076aab5f998464 (diff)
haskellPackages.tensorflow-mnist-input-data: use an attribute set to specify the data files
This is more understandable and safer than using a nested list.
Diffstat (limited to 'pkgs/development/haskell-modules/configuration-tensorflow.nix')
-rw-r--r--pkgs/development/haskell-modules/configuration-tensorflow.nix32
1 files changed, 11 insertions, 21 deletions
diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix
index d1ca474ba4f40..10ee30d81c858 100644
--- a/pkgs/development/haskell-modules/configuration-tensorflow.nix
+++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix
@@ -64,27 +64,17 @@ in
     }:
 
     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;
+      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 = with pkgs.lib; flip mapAttrsToList fileInfos (name: sha256:
+                    pkgs.fetchurl {
+                      url = "http://yann.lecun.com/exdb/mnist/${name}";
+                      inherit sha256;
+                    });
     in
     mkDerivation {
       pname = "tensorflow-mnist-input-data";