Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

texlive: transform into overridable scope and extract generic interface #250626

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions pkgs/tools/typesetting/tex/texlive/bin.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
{ lib, stdenv, fetchurl, fetchpatch, buildPackages
, texlive
, bin, combine, pkgs, src, version
, zlib, libiconv, libpng, libX11
, freetype, gd, libXaw, icu, ghostscript, libXpm, libXmu, libXext
, perl, perlPackages, python3Packages, pkg-config
, libpaper, graphite2, zziplib, harfbuzz, potrace, gmp, mpfr
, brotli, cairo, pixman, xorg, clisp, biber, woff2, xxHash
, makeWrapper, shortenPerlShebang, useFixedHashes, asymptote
, biber-ms
}:
}@args:

# Useful resource covering build options:
# http://tug.org/texlive/doc/tlbuild.html

let
withSystemLibs = map (libname: "--with-system-${libname}");

year = toString ((import ./tlpdb.nix)."00texlive.config").year;
version = year; # keep names simple for now
version = toString args.version.texliveYear; # keep names simple for now

# detect and stop redundant rebuilds that may occur when building new fixed hashes
assertFixedHash = name: src:
if ! useFixedHashes || src ? outputHash then src else throw "The TeX Live package '${src.pname}' must have a fixed hash before building '${name}'.";

common = {
src = fetchurl {
urls = [
"http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/${year}/texlive-${year}0321-source.tar.xz"
"ftp://tug.ctan.org/pub/tex/historic/systems/texlive/${year}/texlive-${year}0321-source.tar.xz"
];
hash = "sha256-X/o0heUessRJBJZFD8abnXvXy55TNX2S20vNT9YXm1Y=";
};
inherit src;

prePatch = ''
for i in texk/kpathsea/mktex*; do
Expand Down Expand Up @@ -77,7 +70,7 @@ let
in rec { # un-indented

inherit (common) cleanBrokenLinks;
texliveYear = year;
texliveYear = version;


core = stdenv.mkDerivation rec {
Expand All @@ -93,8 +86,8 @@ core = stdenv.mkDerivation rec {
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
# configure: error: tangle was not found but is required when cross-compiling.
# dev (himktables) is used when building hitex to generate the additional source file hitables.c
texlive.bin.core
texlive.bin.core.dev
bin.core
bin.core.dev
];

buildInputs = [
Expand Down Expand Up @@ -196,7 +189,7 @@ core = stdenv.mkDerivation rec {
};


inherit (core-big) metafont mflua metapost luatex luahbtex luajittex xetex;
inherit (bin.core-big) metafont mflua metapost luatex luahbtex luajittex xetex;
core-big = stdenv.mkDerivation { #TODO: upmendex
pname = "texlive-core-big.bin";
inherit version;
Expand Down Expand Up @@ -394,7 +387,7 @@ pygmentex = python3Packages.buildPythonApplication rec {
inherit (src) version;
format = "other";

src = assertFixedHash pname (lib.head (builtins.filter (p: p.tlType == "run") texlive.pygmentex.pkgs));
src = assertFixedHash pname (lib.head (builtins.filter (p: p.tlType == "run") pkgs.pygmentex.pkgs));

propagatedBuildInputs = with python3Packages; [ pygments chardet ];

Expand Down Expand Up @@ -475,7 +468,7 @@ xdvi = stdenv.mkDerivation {

xpdfopen = stdenv.mkDerivation {
pname = "texlive-xpdfopen.bin";
inherit (lib.head texlive.xpdfopen.pkgs) version;
inherit (lib.head pkgs.xpdfopen.pkgs) version;

inherit (common) src;

Expand Down Expand Up @@ -510,7 +503,7 @@ xindy = stdenv.mkDerivation {

nativeBuildInputs = [
pkg-config perl
(texlive.combine { inherit (texlive) scheme-basic cyrillic ec; })
(combine { inherit (pkgs) scheme-basic cyrillic ec; })
];
buildInputs = [ clisp libiconv perl ];

Expand Down
10 changes: 5 additions & 5 deletions pkgs/tools/typesetting/tex/texlive/combine.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lib, buildEnv, runCommand, writeText, makeWrapper, libfaketime, makeFontsConf
, perl, bash, coreutils, gnused, gnugrep, gawk, ghostscript
, bin, tl }:
, bin, pkgs }:
# combine =
args@{
pkgFilter ? (pkg: pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "core"
Expand Down Expand Up @@ -49,7 +49,7 @@ let
paths = lib.catAttrs "outPath" pkgList.nonbin;

# mktexlsr
nativeBuildInputs = [ (lib.last tl."texlive.infra".pkgs) ];
nativeBuildInputs = [ (lib.last pkgs."texlive.infra".pkgs) ];

postBuild = # generate ls-R database
''
Expand Down Expand Up @@ -107,9 +107,9 @@ in (buildEnv {
nativeBuildInputs = [
makeWrapper
libfaketime
(lib.last tl."texlive.infra".pkgs) # mktexlsr
(lib.last tl.texlive-scripts.pkgs) # fmtutil, updmap
(lib.last tl.texlive-scripts-extra.pkgs) # texlinks
(lib.last pkgs."texlive.infra".pkgs) # mktexlsr
(lib.last pkgs.texlive-scripts.pkgs) # fmtutil, updmap
(lib.last pkgs.texlive-scripts-extra.pkgs) # texlinks
perl
];

Expand Down
Loading