From 76e92ae984c6d2e5d6fc45bc71ef85617fbdb16e Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Sun, 12 Mar 2023 21:04:39 +0000 Subject: [PATCH] texlive: rename pkgs.nix to tlpdb.nix and generate it from Nixpkgs attribute --- .../typesetting/tex/texlive/UPGRADING.md | 27 ++++++++++++------- .../tools/typesetting/tex/texlive/default.nix | 12 +++++++-- .../tex/texlive/{pkgs.nix => tlpdb.nix} | 0 3 files changed, 28 insertions(+), 11 deletions(-) rename pkgs/tools/typesetting/tex/texlive/{pkgs.nix => tlpdb.nix} (100%) diff --git a/pkgs/tools/typesetting/tex/texlive/UPGRADING.md b/pkgs/tools/typesetting/tex/texlive/UPGRADING.md index 86e650afd46f..7f6dcff40429 100644 --- a/pkgs/tools/typesetting/tex/texlive/UPGRADING.md +++ b/pkgs/tools/typesetting/tex/texlive/UPGRADING.md @@ -33,20 +33,29 @@ See https://tug.org/texlive/acquire-mirror.html for instructions. ### Upgrade package information from texlive package database +First, edit `default.nix` as follows. + +If upgrading to a daily snapshot: +- change `snapshot.year`, `snapshot.month`, `snapshot.day`; +- ensure `urlPrefixes` uses the https://texlive.info/tlnet-archive mirror; +- ensure `texlive.extraVersion` uses the `snapshot` info. + +If upgrading to a final release: +- upgrade `texlive.bin` first; +- ensure `urlPrefixes` uses the historic mirrors; +- ensure `texlive.extraVersion` is `"-final"`. + +Then upgrade `tlpdb.hash` to match the new hash of `texlive.tlpdb.xz` and run ```bash -curl -L https://texlive.info/tlnet-archive/$YEAR/$MONTH/$DAY/tlnet/tlpkg/texlive.tlpdb.xz \ - | xzcat | sed -rn -f ./tl2nix.sed | uniq > ./pkgs.nix +nix-build ../../../../.. -A texlive.tlpdb-nix --no-out-link ``` -This will download the daily snapshot of the CTAN package database `texlive.tlpdb.xz` -and regenerate all of the sha512 hashes for the current upstream distribution in `pkgs.nix`. +This will download the daily snapshot of the CTAN package database +`texlive.tlpdb.xz` and extract the relevant package info (including version +numbers and sha512 hashes) for the selected upstream distribution. Then replace +`tlpdb.nix` with the generated file. -Use the url - -https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/$YEAR/tlnet-final/tlpkg/texlive.tlpdb.xz - -for the final TeX Live release. ### Build packages locally and generate fix hashes diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index c2afce69771b..9737a12c0fbd 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -30,7 +30,7 @@ let # the set of TeX Live packages, collections, and schemes; using upstream naming tl = let - orig = import ./pkgs.nix; + orig = import ./tlpdb.nix; removeSelfDep = lib.mapAttrs (n: p: if p ? deps then p // { deps = lib.filter (dn: n != dn) p.deps; } else p); @@ -146,6 +146,14 @@ let hash = "sha256-i8DE3/rZmtp+gODJWeHV1VcCK5cgHUgmywf3Q/agTOA="; }; + tlpdb-nix = runCommand "tlpdb.nix" { + inherit tlpdb; + tl2nix = ./tl2nix.sed; + } + '' + xzcat "$tlpdb" | sed -rn -f "$tl2nix" | uniq > "$out" + ''; + # create a derivation that contains an unpacked upstream TL package mkPkg = { pname, tlType, revision, version, sha512, postUnpack ? "", stripPrefix ? 1, ... }@args: let @@ -187,7 +195,7 @@ let in tl // { - inherit bin combine; + inherit bin combine tlpdb-nix; # Pre-defined combined packages for TeX Live schemes, # to make nix-env usage more comfortable and build selected on Hydra. diff --git a/pkgs/tools/typesetting/tex/texlive/pkgs.nix b/pkgs/tools/typesetting/tex/texlive/tlpdb.nix similarity index 100% rename from pkgs/tools/typesetting/tex/texlive/pkgs.nix rename to pkgs/tools/typesetting/tex/texlive/tlpdb.nix