texlive: add a new highly granular version, #287
This commit is contained in:
parent
fe5c8d78a0
commit
22fd6e1e4c
225
pkgs/tools/typesetting/tex/texlive-new/bin.nix
Normal file
225
pkgs/tools/typesetting/tex/texlive-new/bin.nix
Normal file
@ -0,0 +1,225 @@
|
||||
{ stdenv, lib, fetchurl
|
||||
, config
|
||||
, zlib, bzip2, ncurses, libpng, flex, bison, libX11, libICE, xproto
|
||||
, freetype, t1lib, gd, libXaw, icu, ghostscript, ed, libXt, libXpm, libXmu, libXext
|
||||
, xextproto, perl, libSM, ruby, expat, curl, libjpeg, python, fontconfig, pkgconfig
|
||||
, poppler, libpaper, graphite2, lesstif, zziplib, harfbuzz, texinfo, potrace, gmp, mpfr
|
||||
, xpdf, cairo, pixman, xorg
|
||||
, makeWrapper
|
||||
}:
|
||||
|
||||
|
||||
let
|
||||
withSystemLibs = map (libname: "--with-system-${libname}");
|
||||
|
||||
year = "2015";
|
||||
version = year; # keep names simple for now
|
||||
|
||||
common = rec {
|
||||
src = fetchurl {
|
||||
url = "ftp://tug.org/historic/systems/texlive/${year}/texlive-20150521-source.tar.xz";
|
||||
sha256 = "ed9bcd7bdce899c3c27c16a8c5c3017c4f09e1d7fd097038351b72497e9d4669";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"--with-banner-add=/NixOS.org"
|
||||
"--disable-missing" "--disable-native-texlive-build"
|
||||
"--enable-shared" # "--enable-cxx-runtime-hack" # static runtime
|
||||
"--enable-tex-synctex"
|
||||
"-C" # use configure cache to speed up
|
||||
]
|
||||
++ withSystemLibs [
|
||||
# see "from TL tree" vs. "Using installed" in configure output
|
||||
"zziplib" "xpdf" "poppler" "mpfr" "gmp"
|
||||
"pixman" "potrace" "gd" "freetype2" "libpng" "libpaper" "zlib"
|
||||
# beware: xpdf means to use stuff from poppler :-/
|
||||
];
|
||||
|
||||
# clean broken links to stuff not built
|
||||
cleanBrokenLinks = ''
|
||||
for f in "$out"/bin/*; do
|
||||
if [[ ! -x "$f" ]]; then rm "$f"; fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
in rec { # un-indented
|
||||
|
||||
inherit (common) cleanBrokenLinks;
|
||||
texliveYear = year;
|
||||
|
||||
|
||||
core = stdenv.mkDerivation rec {
|
||||
name = "texlive-bin-${version}";
|
||||
|
||||
inherit (common) src;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
buildInputs = [
|
||||
pkgconfig
|
||||
/*teckit*/ zziplib poppler mpfr gmp
|
||||
pixman potrace gd freetype libpng libpaper zlib
|
||||
perl
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
rm -r libs/{cairo,freetype2,gd,gmp,graphite2,harfbuzz,icu,libpaper,libpng} \
|
||||
libs/{mpfr,pixman,poppler,potrace,xpdf,zlib,zziplib}
|
||||
mkdir Work
|
||||
cd Work
|
||||
'';
|
||||
configureScript = "../configure";
|
||||
|
||||
configureFlags = common.configureFlags
|
||||
++ [ "--without-x" ] # disable xdvik and xpdfopen
|
||||
++ map (what: "--disable-${what}") [
|
||||
"dvisvgm" "dvipng" # ghostscript dependency
|
||||
"luatex" "luajittex" "mp" "pmp" "upmp" "mf" # cairo would bring in X and more
|
||||
"xetex" "bibtexu" "bibtex8" "bibtex-x" # ICU isn't small
|
||||
]
|
||||
++ [ "--without-system-harfbuzz" "--without-system-icu" ] # bogus configure
|
||||
;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = false; # triptest fails, likely due to missing TEXMF tree
|
||||
preCheck = "patchShebangs ../texk/web2c";
|
||||
|
||||
installTargets = [ "install" "texlinks" ];
|
||||
|
||||
# TODO: perhaps improve texmf.cnf search locations
|
||||
postInstall = /* a few texmf-dist files are useful; take the rest from pkgs */ ''
|
||||
mv "$out/share/texmf-dist/web2c/texmf.cnf" .
|
||||
rm -r "$out/share/texmf-dist"
|
||||
mkdir -p "$out"/share/texmf-dist/{web2c,scripts/texlive/TeXLive}
|
||||
mv ./texmf.cnf "$out/share/texmf-dist/web2c/"
|
||||
cp ../texk/tests/TeXLive/*.pm "$out/share/texmf-dist/scripts/texlive/TeXLive/"
|
||||
cp ../texk/texlive/linked_scripts/scripts.lst "$out/share/texmf-dist/scripts/texlive/"
|
||||
'' + /* doc location identical with individual TeX pkgs */ ''
|
||||
mkdir -p "$doc/doc"
|
||||
mv "$out"/share/{man,info} "$doc"/doc
|
||||
'' + cleanBrokenLinks;
|
||||
|
||||
setupHook = ./setup-hook.sh; # TODO: maybe texmf-nix -> texmf (and all references)
|
||||
passthru = { inherit version buildInputs; };
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Basic binaries for TeX Live";
|
||||
homepage = http://www.tug.org/texlive;
|
||||
license = stdenv.lib.licenses.gpl2;
|
||||
maintainers = with maintainers; [ vcunat lovek323 raskin jwiegley ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inherit (core-big) metafont metapost luatex xetex;
|
||||
core-big = stdenv.mkDerivation {
|
||||
name = "texlive-core-big.bin-${version}";
|
||||
|
||||
inherit (common) src;
|
||||
|
||||
buildInputs = core.buildInputs ++ [ core cairo harfbuzz icu graphite2 ];
|
||||
|
||||
configureFlags = common.configureFlags
|
||||
++ withSystemLibs [ "kpathsea" "ptexenc" "cairo" "harfbuzz" "icu" "graphite2" ]
|
||||
++ map (prog: "--disable-${prog}") # don't build things we already have
|
||||
[ "tex" "ptex" "eptex" "uptex" "euptex" "aleph" "pdftex"
|
||||
"web-progs" "synctex" "luajittex" # luajittex is mostly not needed, see:
|
||||
# http://tex.stackexchange.com/questions/97999/when-to-use-luajittex-in-favour-of-luatex
|
||||
];
|
||||
|
||||
configureScript = ":";
|
||||
|
||||
# we use static libtexlua, because it's only used by a single binary
|
||||
postConfigure = ''
|
||||
mkdir ./Work && cd ./Work
|
||||
for path in libs/{teckit,lua52} texk/web2c; do
|
||||
(
|
||||
if [[ "$path" == "libs/lua52" ]]; then
|
||||
extraConfig="--enable-static --disable-shared"
|
||||
else
|
||||
extraConfig=""
|
||||
fi
|
||||
|
||||
mkdir -p "$path" && cd "$path"
|
||||
"../../../$path/configure" $configureFlags $extraConfig
|
||||
)
|
||||
done
|
||||
'';
|
||||
|
||||
preBuild = "cd texk/web2c";
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# now distribute stuff into outputs, roughly as upstream TL
|
||||
# (uninteresting stuff remains in $out, typically duplicates from `core`)
|
||||
outputs = [ "out" "metafont" "metapost" "luatex" "xetex" ];
|
||||
postInstall = ''
|
||||
for output in $outputs; do
|
||||
mkdir -p "''${!output}/bin"
|
||||
done
|
||||
|
||||
mv "$out/bin"/{inimf,mf,mf-nowin} "$metafont/bin/"
|
||||
mv "$out/bin"/{*tomp,mfplain,*mpost} "$metapost/bin/"
|
||||
mv "$out/bin"/{luatex,texlua*} "$luatex/bin/"
|
||||
mv "$out/bin"/xetex "$xetex/bin/"
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
dvisvgm = stdenv.mkDerivation {
|
||||
name = "texlive-dvisvgm.bin-${version}";
|
||||
|
||||
inherit (common) src;
|
||||
|
||||
buildInputs = [ pkgconfig core/*kpathsea*/ ghostscript zlib freetype potrace ];
|
||||
|
||||
preConfigure = "cd texk/dvisvgm";
|
||||
|
||||
configureFlags = common.configureFlags
|
||||
++ [ "--with-system-kpathsea" "--with-system-libgs" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
};
|
||||
|
||||
|
||||
dvipng = stdenv.mkDerivation {
|
||||
name = "texlive-dvipng.bin-${version}";
|
||||
|
||||
inherit (common) src;
|
||||
|
||||
buildInputs = [ pkgconfig core/*kpathsea*/ zlib libpng freetype gd ghostscript makeWrapper ];
|
||||
|
||||
preConfigure = "cd texk/dvipng";
|
||||
|
||||
configureFlags = common.configureFlags
|
||||
++ [ "--with-system-kpathsea" "--with-gs=yes" "--disable-debug" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# I didn't manage to hardcode gs location by configureFlags
|
||||
postInstall = ''
|
||||
wrapProgram "$out/bin/dvipng" --prefix PATH : '${ghostscript}/bin'
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
bibtexu = bibtex8;
|
||||
bibtex8 = stdenv.mkDerivation {
|
||||
name = "texlive-bibtex-x.bin-${version}";
|
||||
|
||||
inherit (common) src;
|
||||
|
||||
buildInputs = [ pkgconfig core/*kpathsea*/ icu ];
|
||||
|
||||
preConfigure = "cd texk/bibtex-x";
|
||||
|
||||
configureFlags = common.configureFlags
|
||||
++ [ "--with-system-kpathsea" "--with-system-icu" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
};
|
||||
|
||||
|
||||
} # un-indented
|
||||
|
199
pkgs/tools/typesetting/tex/texlive-new/combine.nix
Normal file
199
pkgs/tools/typesetting/tex/texlive-new/combine.nix
Normal file
@ -0,0 +1,199 @@
|
||||
params: with params;
|
||||
# combine =
|
||||
args@{
|
||||
pkgFilter ? (pkg: pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "core")
|
||||
, extraName ? "combined", ...
|
||||
}:
|
||||
let
|
||||
pkgSet = removeAttrs args [ "pkgFilter" "extraName" ] // {
|
||||
# include a fake "core" package
|
||||
core.pkgs = [
|
||||
(bin.core.out // { pname = "core"; tlType = "bin"; })
|
||||
(bin.core.doc // { pname = "core"; tlType = "doc"; })
|
||||
];
|
||||
};
|
||||
pkgList = rec {
|
||||
all = lib.filter pkgFilter (combinePkgs pkgSet);
|
||||
splitBin = lib.partition (p: p.tlType == "bin") all;
|
||||
bin = mkUniquePkgs splitBin.right;
|
||||
nonbin = mkUniquePkgs splitBin.wrong;
|
||||
|
||||
# extra interpreters needed for shebangs, based on 2015 schemes "medium" and "tetex"
|
||||
# (omitted tk needed in pname == "epspdf", bin/epspdftk)
|
||||
pkgNeedsPython = pkg: pkg.tlType == "run" && lib.elem pkg.pname
|
||||
[ "de-macro" "pythontex" "dviasm" "texliveonfly" ];
|
||||
pkgNeedsRuby = pkg: pkg.tlType == "run" && pkg.pname == "match-parens";
|
||||
extraInputs =
|
||||
lib.optional (lib.any pkgNeedsPython splitBin.wrong) python
|
||||
++ lib.optional (lib.any pkgNeedsPython splitBin.wrong) ruby;
|
||||
};
|
||||
|
||||
mkUniquePkgs = pkgs: fastUnique (a: b: a < b)
|
||||
# here we deal with those dummy packages needed for hyphenation filtering
|
||||
(map (p: if lib.isDerivation p then builtins.toPath p else "") pkgs);
|
||||
|
||||
in buildEnv {
|
||||
name = "texlive-${extraName}-${bin.texliveYear}";
|
||||
|
||||
extraPrefix = "/share/texmf";
|
||||
|
||||
ignoreCollisions = false;
|
||||
paths = pkgList.nonbin;
|
||||
|
||||
buildInputs = [ makeWrapper ] ++ pkgList.extraInputs;
|
||||
|
||||
postBuild = ''
|
||||
cd "$out"
|
||||
mkdir -p ./bin
|
||||
'' +
|
||||
lib.concatMapStrings
|
||||
(path: ''
|
||||
for f in '${path}'/bin/*; do
|
||||
if [[ -L "$f" ]]; then
|
||||
cp -d "$f" ./bin/
|
||||
else
|
||||
ln -s "$f" ./bin/
|
||||
fi
|
||||
done
|
||||
'')
|
||||
pkgList.bin
|
||||
+
|
||||
''
|
||||
export PATH="$out/bin:$out/share/texmf/scripts/texlive:${perl}/bin:$PATH"
|
||||
export TEXMFCNF="$out/share/texmf/web2c"
|
||||
export TEXMFDIST="$out/share/texmf"
|
||||
export TEXMFSYSCONFIG="$out/share/texmf-config"
|
||||
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?
|
||||
# tried inspiration from install-tl, sub do_texmf_cnf
|
||||
''
|
||||
(
|
||||
cd ./share/texmf/web2c/
|
||||
local cnfOrig="$(realpath ./texmf.cnf)"
|
||||
rm ./texmf.cnf
|
||||
cat "$cnfOrig" | sed 's/texmf-dist/texmf/g' > ./texmf.cnf
|
||||
|
||||
rm updmap.cfg
|
||||
)
|
||||
'' +
|
||||
# updmap.cfg seems like not needing changes
|
||||
|
||||
# now filter hyphenation patterns, in a hacky way ATM
|
||||
''
|
||||
(
|
||||
local script='${
|
||||
lib.concatMapStrings (pkg: "/^\% from ${pkg.pname}/,/^\%/p;\n")
|
||||
pkgList.splitBin.wrong
|
||||
} 1,/^\% from/p;'
|
||||
cd ./share/texmf/tex/generic/config/
|
||||
for fname in language.dat language.def; do
|
||||
[ -e $fname ] || continue;
|
||||
cnfOrig="$(realpath ./$fname)"
|
||||
rm ./$fname
|
||||
cat "$cnfOrig" | sed -n "$script" > ./$fname
|
||||
done
|
||||
)
|
||||
'' +
|
||||
|
||||
# function to wrap created executables with required env vars
|
||||
''
|
||||
wrapBin() {
|
||||
for link in ./bin/*; do
|
||||
[ -L "$link" -a -x "$link" ] || continue # if not link, assume OK
|
||||
local target=$(readlink "$link")
|
||||
|
||||
# skip simple local symlinks; mktexfmt in particular
|
||||
echo "$target" | grep / > /dev/null || continue;
|
||||
|
||||
echo -n "Wrapping '$link'"
|
||||
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
|
||||
if [[ "$(head -c 2 $target)" = "#!" ]]; then
|
||||
local cmdline="$(head -n 1 $target | sed 's/^\#\! *//;s/ *$//')"
|
||||
local relative=`basename "$cmdline" | sed 's/^env //' `
|
||||
local newInterp=`echo "$relative" | cut -d\ -f1`
|
||||
local params=`echo "$relative" | cut -d\ -f2- -s`
|
||||
local newPath="$(type -P $newInterp)"
|
||||
if [[ -z "$newPath" ]]; then
|
||||
echo " Warning: unknown shebang '$cmdline' in '$target'"
|
||||
continue
|
||||
fi
|
||||
echo " and patching shebang '$cmdline'"
|
||||
sed "s|^exec |exec $newPath $params |" -i "$link"
|
||||
else
|
||||
sed 's|^exec |exec -a "$0" |' -i "$link"
|
||||
echo
|
||||
fi
|
||||
done
|
||||
}
|
||||
'' +
|
||||
# texlive post-install actions
|
||||
''
|
||||
mkdir -p "$out/share/texmf/scripts/texlive/"
|
||||
ln -s '${bin.core.out}/share/texmf-dist/scripts/texlive/TeXLive' "$out/share/texmf/scripts/texlive/"
|
||||
|
||||
for tool in updmap; do
|
||||
ln -sf "$out/share/texmf/scripts/texlive/$tool."* "$out/bin/$tool"
|
||||
done
|
||||
'' +
|
||||
# now hack to preserve "$0" for mktexfmt
|
||||
''
|
||||
cp "$out"/share/texmf/scripts/texlive/fmtutil.pl "$out/bin/fmtutil"
|
||||
patchShebangs "$out/bin/fmtutil"
|
||||
sed "1s|$| -I $out/share/texmf/scripts/texlive|" -i "$out/bin/fmtutil"
|
||||
ln -sf fmtutil "$out/bin/mktexfmt"
|
||||
|
||||
perl `type -P mktexlsr.pl` ./share/texmf
|
||||
texlinks.sh "$out/bin" && wrapBin
|
||||
perl `type -P fmtutil.pl` --sys --refresh | grep '^fmtutil' # too verbose
|
||||
#texlinks.sh "$out/bin" && wrapBin # do we need to regenerate format links?
|
||||
perl `type -P updmap.pl` --sys --syncwithtrees --force
|
||||
perl `type -P mktexlsr.pl` ./share/texmf-* # to make sure
|
||||
'' +
|
||||
# install (wrappers for) scripts, based on a list from upstream texlive
|
||||
''
|
||||
(
|
||||
cd "$out/share/texmf/scripts"
|
||||
source '${bin.core.out}/share/texmf-dist/scripts/texlive/scripts.lst'
|
||||
for s in $texmf_scripts; do
|
||||
[[ -x "./$s" ]] || continue
|
||||
tName="$(basename $s | sed 's/\.[a-z]\+$//')" # remove extension
|
||||
[[ ! -e "$out/bin/$tName" ]] || continue
|
||||
ln -sv "$(realpath $s)" "$out/bin/$tName" # wrapped below
|
||||
done
|
||||
)
|
||||
rm "$out"/bin/*-sys
|
||||
wrapBin
|
||||
'' +
|
||||
# TODO: a context trigger https://www.preining.info/blog/2015/06/debian-tex-live-2015-the-new-layout/
|
||||
# http://wiki.contextgarden.net/ConTeXt_Standalone#Unix-like_platforms_.28Linux.2FMacOS_X.2FFreeBSD.2FSolaris.29
|
||||
|
||||
# I would just create links from "$out"/share/{man,info},
|
||||
# but buildenv has problems with merging symlinks with directories;
|
||||
# note: it's possible we might need deepen the work-around to man/*.
|
||||
''
|
||||
for d in {man,info}; do
|
||||
[[ -e "./share/texmf/doc/$d" ]] || continue;
|
||||
(
|
||||
mkdir -p "./share/$d" && cd "./share/$d"
|
||||
ln -s -t . ../texmf/doc/"$d"/*
|
||||
)
|
||||
done
|
||||
''
|
||||
+ bin.cleanBrokenLinks
|
||||
;
|
||||
}
|
||||
# TODO: make TeX fonts visible by fontconfig: it should be enough to install an appropriate file
|
||||
# similarly, deal with xe(la)tex font visibility?
|
||||
|
199
pkgs/tools/typesetting/tex/texlive-new/default.nix
Normal file
199
pkgs/tools/typesetting/tex/texlive-new/default.nix
Normal file
@ -0,0 +1,199 @@
|
||||
/* (new) TeX Live user docs
|
||||
- Basic usage: just pull texlive.combined.scheme-basic
|
||||
for an environment with basic LaTeX support.
|
||||
There are all the schemes as defined upstream (with tiny differences, perhaps).
|
||||
- You can compose your own collection like this:
|
||||
texlive.combine {
|
||||
inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
|
||||
}
|
||||
- By default you only get executables and files needed during runtime,
|
||||
and a little documentation for the core packages.
|
||||
To change that, you need to add `pkgFilter` function to `combine`.
|
||||
texlive.combine {
|
||||
# inherit (texlive) whatever-you-want;
|
||||
pkgFilter = pkg:
|
||||
pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super";
|
||||
# elem tlType [ "run" "bin" "doc" "source" ]
|
||||
# there are also other attributes: version, name
|
||||
}
|
||||
- Known bugs:
|
||||
* some tools are still missing, e.g. luajittex
|
||||
* some apps aren't packaged/tested yet (xdvi, asymptote, biber, etc.)
|
||||
* feature/bug: when a package is rejected by pkgFilter,
|
||||
its dependencies are still propagated
|
||||
* in case of any bugs or feature requests, file a github issue and /cc @vcunat
|
||||
*/
|
||||
|
||||
{ stdenv, lib, fetchurl, runCommand, buildEnv
|
||||
, callPackage, ghostscriptX, harfbuzz, poppler_min
|
||||
, makeWrapper, perl, python, ruby
|
||||
, useFixedHashes ? true
|
||||
, recurseIntoAttrs
|
||||
}:
|
||||
let
|
||||
# various binaries (compiled)
|
||||
bin = callPackage ./bin.nix {
|
||||
poppler = poppler_min; # otherwise depend on various X stuff
|
||||
ghostscript = ghostscriptX;
|
||||
harfbuzz = harfbuzz.override {
|
||||
withIcu = true; withGraphite2 = true;
|
||||
};
|
||||
};
|
||||
|
||||
# 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.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 perl stdenv python ruby;
|
||||
};
|
||||
|
||||
# the set of TeX Live packages, collections, and schemes; using upstream naming
|
||||
tl = let
|
||||
/* curl ftp://tug.ctan.org/pub/tex/historic/systems/texlive/2015/tlnet-final/tlpkg/texlive.tlpdb.xz \
|
||||
| xzcat | uniq -u | sed -rn -f ./tl2nix.sed > ./pkgs.nix */
|
||||
orig = import ./pkgs.nix tl;
|
||||
clean = orig // {
|
||||
# overrides of texlive.tlpdb
|
||||
|
||||
tetex = orig.tetex // { # 2015.08.27 as we need version with mktexlsr.pl
|
||||
# TODO: official hashed mirror
|
||||
urlPrefix = "http://lipa.ms.mff.cuni.cz/~cunav5am/nix";
|
||||
md5.run = "4b4c0208124dfc9c8244c24421946d36";
|
||||
md5.doc = "983f5e5b5f4e407760b4ec176cf6a58f";
|
||||
version = "3.0"; # it's the same
|
||||
postUnpack = "cd $out && patch -p2 < ${./texlinks.patch} || true";
|
||||
# TODO: postUnpack per tlType instead of these hacks
|
||||
};
|
||||
|
||||
dvidvi = orig.dvidvi // {
|
||||
hasRunfiles = false; # only contains docs that's in bin.core.doc already
|
||||
};
|
||||
texlive-msg-translations = orig.texlive-msg-translations // {
|
||||
hasRunfiles = false; # only *.po for tlmgr
|
||||
};
|
||||
|
||||
# remove dependency-heavy packages from the basic collections
|
||||
collection-basic = orig.collection-basic // {
|
||||
deps = removeAttrs orig.collection-basic.deps [ "luatex" "metafont" "xdvi" ];
|
||||
};
|
||||
latex = orig.latex // {
|
||||
deps = removeAttrs orig.latex.deps [ "luatex" ];
|
||||
};
|
||||
}; # overrides
|
||||
|
||||
# tl =
|
||||
in lib.mapAttrs flatDeps clean;
|
||||
# TODO: texlive.infra for web2c config?
|
||||
|
||||
|
||||
flatDeps = pname: attrs:
|
||||
let
|
||||
version = attrs.version or bin.texliveYear;
|
||||
mkPkgV = tlType: let
|
||||
pkg = attrs // {
|
||||
md5 = attrs.md5.${tlType};
|
||||
inherit pname tlType version;
|
||||
};
|
||||
in mkPkgs {
|
||||
inherit (pkg) pname tlType version;
|
||||
pkgList = [ pkg ];
|
||||
};
|
||||
in {
|
||||
# TL pkg contains lists of packages: runtime files, docs, sources, binaries
|
||||
pkgs =
|
||||
# tarball of a collection/scheme itself only contains a tlobj file
|
||||
[( if (attrs.hasRunfiles or false) then mkPkgV "run"
|
||||
# the fake derivations are used for filtering of hyphenation patterns
|
||||
else { inherit pname version; tlType = "run"; }
|
||||
)]
|
||||
++ lib.optional (attrs.md5 ? "doc") (mkPkgV "doc")
|
||||
++ lib.optional (attrs.md5 ? "source") (mkPkgV "source")
|
||||
++ lib.optional (bin ? ${pname})
|
||||
( bin.${pname} // { inherit pname; tlType = "bin"; } )
|
||||
++ combinePkgs (attrs.deps or {});
|
||||
};
|
||||
|
||||
# the basename used by upstream (without ".tar.xz" suffix)
|
||||
mkUrlName = { pname, tlType, ... }:
|
||||
pname + lib.optionalString (tlType != "run") ".${tlType}";
|
||||
|
||||
unpackPkg =
|
||||
{ # url ? null, urlPrefix ? null
|
||||
md5, pname, tlType, postUnpack ? "", stripPrefix ? 1, ...
|
||||
}@args: let
|
||||
url = args.url or "${urlPrefix}/${mkUrlName args}.tar.xz";
|
||||
urlPrefix = args.urlPrefix or
|
||||
("${mirror}/pub/tex/historic/systems/texlive/${bin.texliveYear}/tlnet-final/archive");
|
||||
# beware: standard mirrors http://mirror.ctan.org/ don't have releases
|
||||
mirror = "ftp://tug.ctan.org"; # also works: ftp.math.utah.edu
|
||||
in ''
|
||||
tar -xf '${ fetchurl { inherit url md5; } }' \
|
||||
'--strip-components=${toString stripPrefix}' \
|
||||
-C "$out" --anchored --exclude=tlpkg --keep-old-files
|
||||
'' + postUnpack;
|
||||
|
||||
mkPkgs = { pname, tlType, version, pkgList }@args:
|
||||
/* TODOs:
|
||||
- "historic" isn't mirrored; posted a question at #287
|
||||
- maybe cache (some) collections? (they don't overlap)
|
||||
*/
|
||||
let
|
||||
tlName = "${mkUrlName args}-${version}";
|
||||
fixedHash = fixedHashes.${tlName} or null; # be graceful about missing hashes
|
||||
in runCommand "texlive-${tlName}"
|
||||
( { # lots of derivations, not meant to be cached
|
||||
preferLocalBuild = true; allowSubstitutes = false;
|
||||
passthru = { inherit pname tlType version; };
|
||||
} // lib.optionalAttrs (fixedHash != null) {
|
||||
outputHash = fixedHash;
|
||||
outputHashAlgo = "sha1";
|
||||
outputHashMode = "recursive";
|
||||
}
|
||||
)
|
||||
( ''
|
||||
mkdir "$out"
|
||||
'' + lib.concatMapStrings unpackPkg (fastUnique (a: b: a.md5 < b.md5) pkgList)
|
||||
);
|
||||
|
||||
# combine a set of TL packages into a single TL meta-package
|
||||
combinePkgs = pkgSet: lib.concatLists # uniqueness is handled in `combine`
|
||||
(lib.mapAttrsToList (_n: a: a.pkgs) pkgSet);
|
||||
|
||||
# TODO: replace by buitin once it exists
|
||||
fastUnique = comparator: list: with lib;
|
||||
let un_adj = l: if length l < 2 then l
|
||||
else optional (head l != elemAt l 1) (head l) ++ un_adj (tail l);
|
||||
in un_adj (lib.sort comparator list);
|
||||
|
||||
in
|
||||
tl // {
|
||||
inherit bin combine;
|
||||
|
||||
# Pre-defined combined packages for TeX Live schemes,
|
||||
# to make nix-env usage more comfortable and build selected on Hydra.
|
||||
combined = with lib; recurseIntoAttrs (
|
||||
mapAttrs
|
||||
(pname: attrs:
|
||||
addMetaAttrs rec {
|
||||
description = "TeX Live environment for ${pname}";
|
||||
platforms = lib.platforms.all;
|
||||
hydraPlatforms = lib.optionals
|
||||
(lib.elem pname ["scheme-small" "scheme-basic"]) platforms;
|
||||
maintainers = [ lib.maintainers.vcunat ];
|
||||
}
|
||||
(combine {
|
||||
${pname} = attrs;
|
||||
extraName = "combined" + lib.removePrefix "scheme" pname;
|
||||
})
|
||||
)
|
||||
{ inherit (tl) scheme-full
|
||||
scheme-tetex scheme-medium scheme-small scheme-basic scheme-minimal
|
||||
scheme-context scheme-gust scheme-xml;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
10
pkgs/tools/typesetting/tex/texlive-new/fixHashes.sh
Executable file
10
pkgs/tools/typesetting/tex/texlive-new/fixHashes.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "{"
|
||||
grep -v -F '.bin-' | while read path; do
|
||||
hash=`nix-hash --type sha1 --base32 "$path"`
|
||||
echo -n "$path" | sed -E 's/[^-]*-texlive-(.*)/"\1"/'
|
||||
echo "=\"$hash\";"
|
||||
done
|
||||
echo "}"
|
||||
|
6509
pkgs/tools/typesetting/tex/texlive-new/fixedHashes.nix
Normal file
6509
pkgs/tools/typesetting/tex/texlive-new/fixedHashes.nix
Normal file
File diff suppressed because it is too large
Load Diff
23413
pkgs/tools/typesetting/tex/texlive-new/pkgs.nix
Normal file
23413
pkgs/tools/typesetting/tex/texlive-new/pkgs.nix
Normal file
File diff suppressed because it is too large
Load Diff
7
pkgs/tools/typesetting/tex/texlive-new/setup-hook.sh
Normal file
7
pkgs/tools/typesetting/tex/texlive-new/setup-hook.sh
Normal file
@ -0,0 +1,7 @@
|
||||
addTeXMFPath () {
|
||||
if test -d "$1/share/texmf-nix"; then
|
||||
export TEXINPUTS="${TEXINPUTS}${TEXINPUTS:+:}$1/share/texmf-nix//:"
|
||||
fi
|
||||
}
|
||||
|
||||
envHooks+=(addTeXMFPath)
|
15
pkgs/tools/typesetting/tex/texlive-new/texlinks.patch
Normal file
15
pkgs/tools/typesetting/tex/texlive-new/texlinks.patch
Normal file
@ -0,0 +1,15 @@
|
||||
Don't overwrite already existing files!
|
||||
|
||||
diff --git a/texmf-dist/scripts/texlive/texlinks.sh b/texmf-dist/scripts/texlive/texlinks.sh
|
||||
index 91540ea..9b1d7ed 100755
|
||||
--- a/texmf-dist/scripts/texlive/texlinks.sh
|
||||
+++ b/texmf-dist/scripts/texlive/texlinks.sh
|
||||
@@ -157,7 +157,7 @@ install_link()
|
||||
verbose_echo "skipped ConTeXtish symlink $src -> $dest (special case)"
|
||||
;;
|
||||
*)
|
||||
- test "x$src" != "x`(ls -ld $src | awk '{print $NF}') 2>/dev/null`" &&
|
||||
+ test ! -f "$src" &&
|
||||
rm -f "$src"
|
||||
|
||||
if test -f "$src"; then
|
31
pkgs/tools/typesetting/tex/texlive-new/tl2nix.sed
Normal file
31
pkgs/tools/typesetting/tex/texlive-new/tl2nix.sed
Normal file
@ -0,0 +1,31 @@
|
||||
# wrap whole file into an attrset
|
||||
1itl: { # no indentation
|
||||
$a}
|
||||
|
||||
# trash packages we don't want
|
||||
/^name .*\./,/^$/d
|
||||
|
||||
# quote package names, as some start with a number :-/
|
||||
s/^name (.*)/name "\1"/
|
||||
|
||||
# form an attrmap per package
|
||||
/^name /s/^name (.*)/\1 = {/p
|
||||
/^$/,1i};
|
||||
|
||||
# extract md5 for runfiles
|
||||
s/^containermd5 (.*)/ md5.run = "\1";/p
|
||||
s/^doccontainermd5 (.*)/ md5.doc = "\1";/p
|
||||
s/^srccontainermd5 (.*)/ md5.source = "\1";/p
|
||||
/^runfiles /i\ hasRunfiles = true;
|
||||
|
||||
# number of path components to strip, defaulting to 1 ("texmf-dist/")
|
||||
/^relocated 1/i\ stripPrefix = 0;
|
||||
|
||||
# extract version and clean unwanted chars from it
|
||||
/^catalogue-version/y/ \/~/_--/
|
||||
/^catalogue-version/s/[\#,:\(\)]//g
|
||||
s/^catalogue-version_(.*)/ version = "\1";/p
|
||||
|
||||
# extract deps
|
||||
s/^depend ([^.]*)$/ deps."\1" = tl."\1";/p
|
||||
|
@ -14809,6 +14809,10 @@ let
|
||||
|
||||
texFunctions = callPackage ../tools/typesetting/tex/nix pkgs;
|
||||
|
||||
# All the new TeX Live is inside. See description in default.nix.
|
||||
texlive = recurseIntoAttrs
|
||||
(callPackage ../tools/typesetting/tex/texlive-new { });
|
||||
|
||||
texLive = builderDefsPackage (callPackage ../tools/typesetting/tex/texlive) {
|
||||
ghostscript = ghostscriptX;
|
||||
harfbuzz = harfbuzz.override {
|
||||
|
Loading…
Reference in New Issue
Block a user