summary refs log tree commit diff
path: root/pkgs/tools/typesetting/tex/texlive/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/typesetting/tex/texlive/default.nix')
-rw-r--r--pkgs/tools/typesetting/tex/texlive/default.nix77
1 files changed, 37 insertions, 40 deletions
diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix
index d0c9da9b913..ba03956ac32 100644
--- a/pkgs/tools/typesetting/tex/texlive/default.nix
+++ b/pkgs/tools/typesetting/tex/texlive/default.nix
@@ -1,11 +1,34 @@
 /* TeX Live user docs
   - source: ../../../../../doc/languages-frameworks/texlive.xml
   - current html: http://nixos.org/nixpkgs/manual/#sec-language-texlive
+
+  Note on upgrading: The texlive package contains a few binaries, defined in
+  bin.nix and released once a year, and several thousand packages from CTAN,
+  defined in pkgs.nix.
+
+  The CTAN mirrors are continuously moving, with more than 100 updates per
+  month. Due to the size of the distribution, we snapshot it and generate nix
+  expressions for all packages in texlive at that point.
+
+  To upgrade this snapshot, run the following:
+  $ curl http://mirror.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz \
+             | xzcat | uniq -u | sed -rn -f ./tl2nix.sed > ./pkgs.nix
+
+  This will regenerate all of the sha512 hashes for the current upstream
+  distribution. You may want to find a more stable mirror, put the distribution
+  on IPFS, or contact a maintainer to get the tarballs from that point in time
+  into a more stable location, so that nix users who are building from source
+  can reproduce your work.
+
+  Upgrading the bin: texlive itself is a large collection of binaries. In order
+  to reduce closure size for users who just need a few of them, we split it into
+  packages such as core, core-big, xvdi, etc. This requires making assumptions
+  about dependencies between the projects that may change between releases; if
+  you upgrade you may have to do some work here.
 */
 { stdenv, lib, fetchurl, runCommand, writeText, buildEnv
 , callPackage, ghostscriptX, harfbuzz, poppler_min
 , makeWrapper, python, ruby, perl
-, useFixedHashes ? true
 , recurseIntoAttrs
 }:
 let
@@ -18,13 +41,6 @@ let
     };
   };
 
-  # map: name -> fixed-output hash
-  # sha1 in base32 was chosen as a compromise between security and length
-  # warning: the following generator command takes lots of resources
-  # nix-build ../../../../.. -Q -A texlive.scheme-full.pkgs | ./fixHashes.sh > ./fixedHashes-new.nix
-  # mv ./fixedHashes{-new,}.nix
-  fixedHashes = lib.optionalAttrs useFixedHashes (import ./fixedHashes.nix);
-
   # function for creating a working environment from a set of TL packages
   combine = import ./combine.nix {
     inherit bin combinePkgs buildEnv fastUnique lib makeWrapper writeText
@@ -34,9 +50,6 @@ let
 
   # the set of TeX Live packages, collections, and schemes; using upstream naming
   tl = let
-    /* # beware: the URL below changes contents continuously
-      curl http://mirror.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz \
-        | xzcat | uniq -u | sed -rn -f ./tl2nix.sed > ./pkgs.nix */
     orig = import ./pkgs.nix tl;
     removeSelfDep = lib.mapAttrs
       (n: p: if p ? deps then p // { deps = lib.filterAttrs (dn: _: n != dn) p.deps; }
@@ -103,7 +116,6 @@ let
       # the basename used by upstream (without ".tar.xz" suffix)
       urlName = pname + lib.optionalString (tlType != "run") ".${tlType}";
       tlName = urlName + "-${version}";
-      fixedHash = fixedHashes.${tlName} or null; # be graceful about missing hashes
 
       urls = args.urls or (if args ? url then [ args.url ] else
               map (up: "${up}/${urlName}.tar.xz") urlPrefixes
@@ -113,9 +125,14 @@ let
       # Common packages should get served from the binary cache anyway.
       # See discussions, e.g. https://github.com/NixOS/nixpkgs/issues/24683
       urlPrefixes = args.urlPrefixes or [
-        http://146.185.144.154/texlive-2017
-        # IPFS GW is second, as it doesn't have a good time-outing behavior
-        http://gateway.ipfs.io/ipfs/QmRLK45EC828vGXv5YDaBsJBj2LjMjjA2ReLVrXsasRzy7/texlive-2017
+        # Should be stable for historic, archived releases
+        http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2017/tlnet-final/archive
+
+        # TODO: Add IPFS and see if @veprbl is willing to add a texlive-2017-final mirror,
+        # or if we should just dump it and go to 2018.
+
+        # The canonical source moves quickly and will be broken almost immediately
+        # http://mirror.ctan.org/tex-archive/systems/texlive/tlnet/archive
       ];
 
       src = fetchurl { inherit urls sha512; };
@@ -129,30 +146,11 @@ let
           -C "$out" --anchored --exclude=tlpkg --keep-old-files
       '' + postUnpack;
 
-    in if sha512 == "" then
-      # hash stripped from pkgs.nix to save space -> fetch&unpack in a single step
-      fetchurl {
-        inherit urls;
-        sha1 = if fixedHash == null then throw "TeX Live package ${tlName} is missing hash!"
-          else fixedHash;
-        name = tlName;
-        recursiveHash = true;
-        downloadToTemp = true;
-        postFetch = ''mkdir "$out";'' + unpackCmd "$downloadedFile";
-        # TODO: perhaps override preferHashedMirrors and allowSubstitutes
+    in runCommand "texlive-${tlName}" {
+        # lots of derivations, not meant to be cached
+        preferLocalBuild = true; allowSubstitutes = false;
+        inherit passthru;
       }
-        // passthru
-
-    else runCommand "texlive-${tlName}"
-      ( { # lots of derivations, not meant to be cached
-          preferLocalBuild = true; allowSubstitutes = false;
-          inherit passthru;
-        } // lib.optionalAttrs (fixedHash != null) {
-          outputHash = fixedHash;
-          outputHashAlgo = "sha1";
-          outputHashMode = "recursive";
-        }
-      )
       ( ''
           mkdir "$out"
         '' + unpackCmd "'${src}'"
@@ -190,9 +188,8 @@ in
           })
         )
         { inherit (tl)
-            scheme-basic scheme-context scheme-full scheme-gust scheme-infraonly
+            scheme-basic scheme-context scheme-full scheme-gust
             scheme-medium scheme-minimal scheme-small scheme-tetex;
         }
     );
   }
-