about summary refs log tree commit diff
path: root/pkgs/tools/typesetting
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-04-26 00:02:00 +0000
committerGitHub <noreply@github.com>2023-04-26 00:02:00 +0000
commit134b2c37680275f16d1c95ce45668f27a8733ac4 (patch)
treeac2d4f657de103b0a8ac8b81a77d7a70e34bcacd /pkgs/tools/typesetting
parent2e27a36b4be01a78c19366658c66b42a9b86a54f (diff)
parent64a2fcb824b6451a56c3cbced5c180689b8e55f9 (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/tools/typesetting')
-rw-r--r--pkgs/tools/typesetting/tex/texlive/combine.nix28
1 files changed, 14 insertions, 14 deletions
diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix
index 80070cc6cfaa0..9ccd2cfe76142 100644
--- a/pkgs/tools/typesetting/tex/texlive/combine.nix
+++ b/pkgs/tools/typesetting/tex/texlive/combine.nix
@@ -235,19 +235,13 @@ in (buildEnv {
     ln -sf fmtutil "$out/bin/mktexfmt"
 
     texlinks "$out/bin" && wrapBin
-    FORCE_SOURCE_DATE=1 fmtutil --sys --all | grep '^fmtutil' # too verbose
-    #texlinks "$out/bin" && wrapBin # do we need to regenerate format links?
 
-    # tex intentionally ignores SOURCE_DATE_EPOCH even when FORCE_SOURCE_DATE=1
-    # https://salsa.debian.org/live-team/live-build/-/blob/master/examples/hooks/reproducible/0139-reproducible-texlive-binaries-fmt-files.hook.chroot#L52
-    if [[ -f "$TEXMFSYSVAR"/web2c/tex/tex.fmt ]]
-    then
-      faketime $(date --utc -d@$SOURCE_DATE_EPOCH --iso-8601=seconds) tex -output-directory "$TEXMFSYSVAR"/web2c/tex -ini -jobname=tex -progname=tex tex.ini
-    fi
-    if [[ -f "$TEXMFSYSVAR"/web2c/luahbtex/lualatex.fmt ]]
-    then
-      faketime $(date --utc -d@$SOURCE_DATE_EPOCH --iso-8601=seconds) luahbtex --output-directory="$TEXMFSYSVAR"/web2c/luahbtex -ini -jobname=lualatex -progname=lualatex lualatex.ini
-    fi
+    # many formats still ignore SOURCE_DATE_EPOCH even when FORCE_SOURCE_DATE=1
+    # libfaketime fixes non-determinism related to timestamps ignoring FORCE_SOURCE_DATE
+    # we cannot fix further randomness caused by luatex; for further details, see
+    # https://salsa.debian.org/live-team/live-build/-/blob/master/examples/hooks/reproducible/2006-reproducible-texlive-binaries-fmt-files.hook.chroot#L52
+    FORCE_SOURCE_DATE=1 TZ= faketime -f '@1980-01-01 00:00:00 x0.001' fmtutil --sys --all | grep '^fmtutil' # too verbose
+    #texlinks "$out/bin" && wrapBin # do we need to regenerate format links?
 
     # Disable unavailable map files
     echo y | updmap --sys --syncwithtrees --force
@@ -298,14 +292,20 @@ in (buildEnv {
 
   # MkIV uses its own lookup mechanism and we need to initialize
   # caches for it.
+  # We use faketime to fix the embedded timestamps and patch the uuids
+  # with some random but constant values.
   ''
     if [[ -e "$out/bin/mtxrun" ]]; then
-      mtxrun --generate
+      substitute "$TEXMFDIST"/scripts/context/lua/mtxrun.lua mtxrun.lua \
+        --replace 'cache_uuid=osuuid()' 'cache_uuid="e2402e51-133d-4c73-a278-006ea4ed734f"' \
+        --replace 'uuid=osuuid(),' 'uuid="242be807-d17e-4792-8e39-aa93326fc871",'
+      FORCE_SOURCE_DATE=1 TZ= faketime -f '@1980-01-01 00:00:00 x0.001' luatex --luaonly mtxrun.lua --generate
     fi
   ''
     + bin.cleanBrokenLinks +
   # Get rid of all log files. They are not needed, but take up space
-  # and render the build unreproducible by their embedded timestamps.
+  # and render the build unreproducible by their embedded timestamps
+  # and other non-deterministic diagnostics.
   ''
     find "$TEXMFSYSVAR"/web2c -name '*.log' -delete
   ''