summary refs log tree commit diff
path: root/pkgs/tools/typesetting/tex/texlive-new/combine.nix
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2016-05-18 17:10:02 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2016-05-18 17:10:02 +0200
commitf8d481754cf842ca6e6ac1427ce0f571f5a44108 (patch)
tree70e702285987429aed275e0d5e2dc15c050e1f8c /pkgs/tools/typesetting/tex/texlive-new/combine.nix
parent9fbc20e2f89bc045efac7ade41949a2c2d571dec (diff)
parent3cd63ade1614d4c581735ffb0cebe181bf87dfc8 (diff)
downloadnixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar.gz
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar.bz2
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar.lz
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar.xz
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.tar.zst
nixlib-f8d481754cf842ca6e6ac1427ce0f571f5a44108.zip
Merge remote-tracking branch 'origin/master' into hardened-stdenv
Diffstat (limited to 'pkgs/tools/typesetting/tex/texlive-new/combine.nix')
-rw-r--r--pkgs/tools/typesetting/tex/texlive-new/combine.nix38
1 files changed, 31 insertions, 7 deletions
diff --git a/pkgs/tools/typesetting/tex/texlive-new/combine.nix b/pkgs/tools/typesetting/tex/texlive-new/combine.nix
index e69c6ec425c3..1faf731fd76d 100644
--- a/pkgs/tools/typesetting/tex/texlive-new/combine.nix
+++ b/pkgs/tools/typesetting/tex/texlive-new/combine.nix
@@ -66,15 +66,43 @@ in buildEnv {
     export TEXMFSYSVAR="$out/share/texmf-var"
     export PERL5LIB="$out/share/texmf/scripts/texlive"
   '' +
-    # patch texmf-dist -> texmf to be sure
-    # TODO: cleanup the search paths incl. SELFAUTOLOC, and perhaps do lua actions?
+    # patch texmf-{dist,local} -> texmf to be sure
+    # TODO: perhaps do lua actions?
     # tried inspiration from install-tl, sub do_texmf_cnf
   ''
+    patchCnfLua() {
+      local cnfLua="$1"
+
+      if [ -e "$cnfLua" ]; then
+        local cnfLuaOrig="$(realpath "$cnfLua")"
+        rm ./texmfcnf.lua
+        sed \
+          -e 's,texmf-dist,texmf,g' \
+          -e 's,texmf-local,texmf,g' \
+          -e "s,\(TEXMFLOCAL[ ]*=[ ]*\)[^\,]*,\1\"$out/share/texmf\",g" \
+          -e "s,\$SELFAUTOLOC,$out,g" \
+          -e "s,selfautodir:/,$out/share/,g" \
+          -e "s,selfautodir:,$out/share/,g" \
+          -e "s,selfautoparent:/,$out/share/,g" \
+          -e "s,selfautoparent:,$out/share/,g" \
+          "$cnfLuaOrig" > "$cnfLua"
+      fi
+    }
+
     (
       cd ./share/texmf/web2c/
       local cnfOrig="$(realpath ./texmf.cnf)"
       rm ./texmf.cnf
-      cat "$cnfOrig" | sed 's/texmf-dist/texmf/g' > ./texmf.cnf
+      sed \
+        -e 's,texmf-dist,texmf,g' \
+        -e 's,texmf-local,texmf,g' \
+        -e "s,\$SELFAUTOLOC,$out,g" \
+        -e "s,\$SELFAUTODIR,$out/share,g" \
+        -e "s,\$SELFAUTOPARENT,$out/share,g" \
+        -e "s,\$SELFAUTOGRANDPARENT,$out/share,g" \
+        "$cnfOrig" > ./texmf.cnf
+
+      patchCnfLua "./texmfcnf.lua"
 
       rm updmap.cfg
     )
@@ -112,10 +140,6 @@ in buildEnv {
       rm "$link"
       makeWrapper "$target" "$link" \
         --prefix PATH : "$out/bin:${perl}/bin" \
-        --set TEXMFCNF "$out/share/texmf/web2c" \
-        --set TEXMFDIST "$out/share/texmf" \
-        --set TEXMFSYSCONFIG "$out/share/texmf-config" \
-        --set TEXMFSYSVAR "$out/share/texmf-var" \
         --prefix PERL5LIB : "$out/share/texmf/scripts/texlive"
 
       # avoid using non-nix shebang in $target by calling interpreter