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.
This commit is contained in:
Bas van Dijk 2018-09-06 08:43:04 +02:00
parent 11e2009821
commit 6bd8799448

View File

@ -64,27 +64,17 @@ in
}: }:
let let
urlPrefix = "http://yann.lecun.com/exdb/mnist/"; fileInfos = {
"train-images-idx3-ubyte.gz" = "440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609";
# File names relative to 'urlPrefix' and their sha256. "train-labels-idx1-ubyte.gz" = "3552534a0a558bbed6aed32b30c495cca23d567ec52cac8be1a0730e8010255c";
fileInfos = [ "t10k-images-idx3-ubyte.gz" = "8d422c7b0a1c1c79245a5bcf07fe86e33eeafee792b84584aec276f5a2dbc4e6";
[ "train-images-idx3-ubyte.gz" "t10k-labels-idx1-ubyte.gz" = "f7ae60f92e00ec6debd23a6088c31dbd2371eca3ffa0defaefb259924204aec6";
"440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609" };
] downloads = with pkgs.lib; flip mapAttrsToList fileInfos (name: sha256:
pkgs.fetchurl {
[ "train-labels-idx1-ubyte.gz" url = "http://yann.lecun.com/exdb/mnist/${name}";
"3552534a0a558bbed6aed32b30c495cca23d567ec52cac8be1a0730e8010255c" inherit sha256;
] });
[ "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 in
mkDerivation { mkDerivation {
pname = "tensorflow-mnist-input-data"; pname = "tensorflow-mnist-input-data";