texlive: more robust way to fetch

/cc #30332.  Thanks to @vprbl for the http mirror.
This commit is contained in:
Vladimír Čunát 2017-12-15 20:10:18 +01:00
parent 5687f61b19
commit 1b555c57ec
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA

View File

@ -110,15 +110,16 @@ let
tlName = urlName + "-${version}"; tlName = urlName + "-${version}";
fixedHash = fixedHashes.${tlName} or null; # be graceful about missing hashes fixedHash = fixedHashes.${tlName} or null; # be graceful about missing hashes
url = args.url or "${urlPrefix}/${urlName}.tar.xz"; urls = args.urls or (if args ? url then [ args.url ] else
urlPrefix = args.urlPrefix or map (up: "${up}/${urlName}.tar.xz") urlPrefixes
https://gateway.ipfs.io/ipfs/QmRLK45EC828vGXv5YDaBsJBj2LjMjjA2ReLVrXsasRzy7/texlive-2017 );
#http://146.185.144.154/texlive-2017 urlPrefixes = args.urlPrefixes or [
; http://146.185.144.154/texlive-2017
# XXX XXX XXX FIXME: mirror the snapshot XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX # IPFS GW is second, as it doesn't have a good time-outing behavior
# ("${mirror}/pub/tex/historic/systems/texlive/${bin.texliveYear}/tlnet-final/archive"); http://gateway.ipfs.io/ipfs/QmRLK45EC828vGXv5YDaBsJBj2LjMjjA2ReLVrXsasRzy7/texlive-2017
#mirror = "http://ftp.math.utah.edu"; ];
src = fetchurl { inherit url sha512; };
src = fetchurl { inherit urls sha512; };
passthru = { passthru = {
inherit pname tlType version; inherit pname tlType version;
@ -132,7 +133,7 @@ let
in if sha512 == "" then in if sha512 == "" then
# hash stripped from pkgs.nix to save space -> fetch&unpack in a single step # hash stripped from pkgs.nix to save space -> fetch&unpack in a single step
fetchurl { fetchurl {
inherit url; inherit urls;
sha1 = if fixedHash == null then throw "TeX Live package ${tlName} is missing hash!" sha1 = if fixedHash == null then throw "TeX Live package ${tlName} is missing hash!"
else fixedHash; else fixedHash;
name = tlName; name = tlName;