From 76c861aaabab6f7f19790f00a5147efcd98bc1f3 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Sun, 12 Mar 2023 21:04:26 +0000 Subject: [PATCH 1/3] texlive: use same urlPrefixes for tlpdb and packages --- .../tools/typesetting/tex/texlive/default.nix | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index 94b8c2db9035..c2afce69771b 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -126,13 +126,23 @@ let day = "27"; }; + # The tarballs on CTAN mirrors for the current release are constantly + # receiving updates, so we can't use those directly. Stable snapshots + # need to be used instead. Ideally, for the release branches of NixOS we + # should be switching to the tlnet-final versions + # (https://tug.org/historic/). + urlPrefixes = [ + # tlnet-final snapshot + #"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${bin.texliveYear}/tlnet-final/archive" + #"ftp://tug.org/texlive/historic/${bin.texliveYear}/tlnet-final/archive" + + # Daily snapshots hosted by one of the texlive release managers + "https://texlive.info/tlnet-archive/${snapshot.year}/${snapshot.month}/${snapshot.day}/tlnet/archive" + ]; + tlpdb = fetchurl { # use the same mirror(s) as urlPrefixes below - urls = [ - #"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${bin.texliveYear}/tlnet-final/tlpkg/texlive.tlpdb.xz" - #"ftp://tug.org/texlive/historic/${bin.texliveYear}/tlnet-final/tlpkg/texlive.tlpdb.xz" - "https://texlive.info/tlnet-archive/${snapshot.year}/${snapshot.month}/${snapshot.day}/tlnet/tlpkg/texlive.tlpdb.xz" - ]; + urls = map (up: "${up}/../tlpkg/texlive.tlpdb.xz") urlPrefixes; hash = "sha256-i8DE3/rZmtp+gODJWeHV1VcCK5cgHUgmywf3Q/agTOA="; }; @@ -145,21 +155,7 @@ let 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}.r${toString revision}.tar.xz") urlPrefixes); - - # The tarballs on CTAN mirrors for the current release are constantly - # receiving updates, so we can't use those directly. Stable snapshots - # need to be used instead. Ideally, for the release branches of NixOS we - # should be switching to the tlnet-final versions - # (https://tug.org/historic/). - urlPrefixes = args.urlPrefixes or [ - # tlnet-final snapshot - #"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${bin.texliveYear}/tlnet-final/archive" - #"ftp://tug.org/texlive/historic/${bin.texliveYear}/tlnet-final/archive" - - # Daily snapshots hosted by one of the texlive release managers - "https://texlive.info/tlnet-archive/${snapshot.year}/${snapshot.month}/${snapshot.day}/tlnet/archive" - ]; + map (up: "${up}/${urlName}.r${toString revision}.tar.xz") (args.urlPrefixes or urlPrefixes)); in runCommand "texlive-${tlName}" ( { 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 2/3] 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 From 1f2ad5bcd40221c65a7d3e2dba0c6cc3a11eeca2 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 3/3] tests.texlive: check that tlpdb.nix is the one generated from the upstream texlive.tlpdb.xz --- pkgs/test/texlive/default.nix | 9 +++++++++ pkgs/tools/typesetting/tex/texlive/UPGRADING.md | 2 ++ 2 files changed, 11 insertions(+) diff --git a/pkgs/test/texlive/default.nix b/pkgs/test/texlive/default.nix index cb607f3a1328..db83bd5149ff 100644 --- a/pkgs/test/texlive/default.nix +++ b/pkgs/test/texlive/default.nix @@ -2,6 +2,15 @@ { + tlpdb-nix = runCommand "texlive-test-tlpdb-nix" { + nixpkgsTlpdbNix = ../../tools/typesetting/tex/texlive/tlpdb.nix; + tlpdbNix = texlive.tlpdb-nix; + } + '' + mkdir -p "$out" + diff -u "''${nixpkgsTlpdbNix}" "''${tlpdbNix}" | tee "$out/tlpdb.nix.patch" + ''; + luaotfload-fonts = runCommand "texlive-test-lualatex" { nativeBuildInputs = [ (with texlive; combine { inherit scheme-medium libertinus-fonts; }) diff --git a/pkgs/tools/typesetting/tex/texlive/UPGRADING.md b/pkgs/tools/typesetting/tex/texlive/UPGRADING.md index 7f6dcff40429..acad0646d2b9 100644 --- a/pkgs/tools/typesetting/tex/texlive/UPGRADING.md +++ b/pkgs/tools/typesetting/tex/texlive/UPGRADING.md @@ -56,6 +56,8 @@ This will download the daily snapshot of the CTAN package database numbers and sha512 hashes) for the selected upstream distribution. Then replace `tlpdb.nix` with the generated file. +The test `pkgs.tests.texlive.tlpdb-nix` verifies that the file `tlpdb.nix` +in Nixpkgs matches the one that generated from `texlive.tlpdb.xz`. ### Build packages locally and generate fix hashes