about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
commitf34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch)
tree32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/tools/typesetting
parent003ab91dd67b093890db1dd0bab564345db6e496 (diff)
parent7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff)
downloadnixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/tools/typesetting')
-rw-r--r--nixpkgs/pkgs/tools/typesetting/asciidoctorj/default.nix4
-rw-r--r--nixpkgs/pkgs/tools/typesetting/hayagriva/default.nix6
-rw-r--r--nixpkgs/pkgs/tools/typesetting/satysfi/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/typesetting/sile/default.nix4
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tectonic/biber.nix54
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tectonic/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tectonic/tests.nix87
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tectonic/wrapper.nix58
8 files changed, 224 insertions, 27 deletions
diff --git a/nixpkgs/pkgs/tools/typesetting/asciidoctorj/default.nix b/nixpkgs/pkgs/tools/typesetting/asciidoctorj/default.nix
index 91ce383f9a4d..fd2bc2eabdb8 100644
--- a/nixpkgs/pkgs/tools/typesetting/asciidoctorj/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/asciidoctorj/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "asciidoctorj";
-  version = "2.5.10";
+  version = "2.5.11";
 
   src = fetchzip {
     url = "mirror://maven/org/asciidoctor/${pname}/${version}/${pname}-${version}-bin.zip";
-    sha256 = "sha256-uhGwZkr5DaoQGkH+romkD7bQTLr+O8Si+wQcZXyMWOI=";
+    sha256 = "sha256-Eagq8a6xTMonaiyhuuHc47pD8gE6jqWx7cZ3xJykmeQ=";
   };
 
   nativeBuildInputs = [ makeWrapper ];
diff --git a/nixpkgs/pkgs/tools/typesetting/hayagriva/default.nix b/nixpkgs/pkgs/tools/typesetting/hayagriva/default.nix
index 2a49d0b727ed..03aea70ae6cf 100644
--- a/nixpkgs/pkgs/tools/typesetting/hayagriva/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/hayagriva/default.nix
@@ -5,14 +5,14 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "hayagriva";
-  version = "0.5.0";
+  version = "0.5.1";
 
   src = fetchCrate {
     inherit pname version;
-    hash = "sha256-oUIMtyQoOqn3C8XOSLFHso76GOHB54ZoLBSDWaDcqdE=";
+    hash = "sha256-nXfoPAUU8pDUj8MdpiYbN9ToJbWk4CsUTGehgGDvykg=";
   };
 
-  cargoHash = "sha256-l1iFF44qTaBu2QDxkTLZTo+R32OTu5za1qdXtq43IM8=";
+  cargoHash = "sha256-xKCnHqQn4mNvZ9LBgDnD4VDlUBgRO1SYLmvqq11GFsc=";
 
   buildFeatures = [ "cli" ];
 
diff --git a/nixpkgs/pkgs/tools/typesetting/satysfi/default.nix b/nixpkgs/pkgs/tools/typesetting/satysfi/default.nix
index 7284e2cc2fdc..1478da2d7675 100644
--- a/nixpkgs/pkgs/tools/typesetting/satysfi/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/satysfi/default.nix
@@ -10,15 +10,6 @@ let
       sha256 = "1s8wcqdkl1alvfcj67lhn3qdz8ikvd1v64f4q6bi4c0qj9lmp30k";
     };
   };
-  otfm = ocamlPackages.otfm.overrideAttrs (o: {
-    src = fetchFromGitHub {
-      owner = "gfngfn";
-      repo = "otfm";
-      rev = "v0.3.7+satysfi";
-      sha256 = "0y8s0ij1vp1s4h5y1hn3ns76fzki2ba5ysqdib33akdav9krbj8p";
-    };
-    propagatedBuildInputs = o.propagatedBuildInputs ++ [ ocamlPackages.result ];
-  });
   yojson-with-position = ocamlPackages.buildDunePackage {
     pname = "yojson-with-position";
     version = "1.4.2";
@@ -28,7 +19,6 @@ let
       rev = "v1.4.2+satysfi";
       sha256 = "17s5xrnpim54d1apy972b5l08bph4c0m5kzbndk600fl0vnlirnl";
     };
-    duneVersion = "3";
     nativeBuildInputs = [ ocamlPackages.cppo ];
     propagatedBuildInputs = [ ocamlPackages.biniou ];
     inherit (ocamlPackages.yojson) meta;
@@ -36,12 +26,12 @@ let
 in
   ocamlPackages.buildDunePackage rec {
     pname = "satysfi";
-    version = "0.0.8";
+    version = "0.0.10";
     src = fetchFromGitHub {
       owner = "gfngfn";
       repo = "SATySFi";
       rev = "v${version}";
-      sha256 = "sha256-cVGe1N3qMlEGAE/jPUji/X3zlijadayka1OL6iFioY4=";
+      hash = "sha256-qgVM7ExsKtzNQkZO+I+rcWLj4LSvKL5uyitH7Jg+ns0=";
       fetchSubmodules = true;
     };
 
@@ -51,13 +41,12 @@ in
       $out/share/satysfi
     '';
 
-    duneVersion = "3";
-
     nativeBuildInputs = with ocamlPackages; [ menhir cppo ];
 
-    buildInputs = [ camlpdf otfm yojson-with-position ] ++ (with ocamlPackages; [
+    buildInputs = [ camlpdf yojson-with-position ] ++ (with ocamlPackages; [
       menhirLib
       batteries camlimages core_kernel ppx_deriving uutf omd re
+      otfed
     ]);
 
     postInstall = ''
diff --git a/nixpkgs/pkgs/tools/typesetting/sile/default.nix b/nixpkgs/pkgs/tools/typesetting/sile/default.nix
index f2005f491a17..b82704fc12b1 100644
--- a/nixpkgs/pkgs/tools/typesetting/sile/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/sile/default.nix
@@ -46,11 +46,11 @@ in
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "sile";
-  version = "0.14.13";
+  version = "0.14.14";
 
   src = fetchurl {
     url = "https://github.com/sile-typesetter/sile/releases/download/v${finalAttrs.version}/sile-${finalAttrs.version}.tar.xz";
-    sha256 = "sha256-PU9Yfanmyr4nAQMQu/unBQSQCvV2hyo0i8lR0MnuFcA=";
+    sha256 = "sha256-xGcbD43yfJ6Ru7mU7R+NxfK1YXnIDwcYMjB++gcNqYg=";
   };
 
   configureFlags = [
diff --git a/nixpkgs/pkgs/tools/typesetting/tectonic/biber.nix b/nixpkgs/pkgs/tools/typesetting/tectonic/biber.nix
new file mode 100644
index 000000000000..9798c1471667
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/tectonic/biber.nix
@@ -0,0 +1,54 @@
+/*
+  This package, `biber-for-tectonic`, provides a compatible version of `biber`
+  as an optional runtime dependency of `tectonic`.
+
+  The development of tectonic is slowing down recently, such that its `biber`
+  dependency has been lagging behind the one in the nixpkgs `texlive` bundle.
+  See:
+
+  https://github.com/tectonic-typesetting/tectonic/discussions/1122
+
+  It is now feasible to track the biber dependency in nixpkgs, as the
+  version bump is not very frequent, and it would provide a more complete
+  user experience of tectonic in nixpkgs.
+*/
+
+{ lib
+, fetchFromGitHub
+, fetchpatch
+, biber
+}:
+
+let version = "2.17"; in (
+  biber.override {
+    /*
+      It is necessary to first override the `version` data here, which is
+      passed to `buildPerlModule`, and then to `mkDerivation`.
+
+      If we simply do `biber.overrideAttrs` the resulting package `name`
+      would be incorrect, since it has already been preprocessed by
+      `buildPerlModule`.
+    */
+    texlive.pkgs.biber.texsource = {
+      inherit version;
+      inherit (biber) pname meta;
+    };
+  }
+).overrideAttrs (prevAttrs: {
+  src = fetchFromGitHub {
+    owner = "plk";
+    repo = "biber";
+    rev = "v${version}";
+    hash = "sha256-Tt2sN2b2NGxcWyZDj5uXNGC8phJwFRiyH72n3yhFCi0=";
+  };
+  patches = [
+    # Perl>=5.36.0 compatibility
+    (fetchpatch {
+      url = "https://patch-diff.githubusercontent.com/raw/plk/biber/pull/411.patch";
+      hash = "sha256-osgldRVfe3jnMSOMnAMQSB0Ymc1s7J6KtM2ig3c93SE=";
+    })
+  ];
+  meta = prevAttrs.meta // {
+    maintainers = with lib.maintainers; [ doronbehar bryango ];
+  };
+})
diff --git a/nixpkgs/pkgs/tools/typesetting/tectonic/default.nix b/nixpkgs/pkgs/tools/typesetting/tectonic/default.nix
index 607e71cfbb44..6b98a5db6343 100644
--- a/nixpkgs/pkgs/tools/typesetting/tectonic/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/tectonic/default.nix
@@ -1,3 +1,11 @@
+/*
+  This file provides the `tectonic-unwrapped` package. On the other hand,
+  the `tectonic` package is defined in `./wrapper.nix`, by wrapping
+  - [`tectonic-unwrapped`](./default.nix) i.e. this package, and
+  - [`biber-for-tectonic`](./biber.nix),
+    which provides a compatible version of `biber`.
+*/
+
 { lib
 , stdenv
 , fetchFromGitHub
@@ -25,7 +33,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoHash = "sha256-1WjZbmZFPB1+QYpjqq5Y+fDkMZNmWJYIxmMFWg7Tiac=";
 
-  nativeBuildInputs = [ pkg-config makeBinaryWrapper ];
+  nativeBuildInputs = [ pkg-config ];
 
   buildInputs = [ icu fontconfig harfbuzz openssl ]
     ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ ApplicationServices Cocoa Foundation ]);
@@ -33,13 +41,14 @@ rustPlatform.buildRustPackage rec {
   # workaround for https://github.com/NixOS/nixpkgs/issues/166205
   NIX_LDFLAGS = lib.optionalString (stdenv.cc.isClang && stdenv.cc.libcxx != null) " -l${stdenv.cc.libcxx.cxxabi.libName}";
 
-  postInstall = lib.optionalString stdenv.isLinux ''
+  postInstall = ''
+    # Makes it possible to automatically use the V2 CLI API
+    ln -s $out/bin/tectonic $out/bin/nextonic
+  '' + lib.optionalString stdenv.isLinux ''
     substituteInPlace dist/appimage/tectonic.desktop \
       --replace Exec=tectonic Exec=$out/bin/tectonic
     install -D dist/appimage/tectonic.desktop -t $out/share/applications/
     install -D dist/appimage/tectonic.svg -t $out/share/icons/hicolor/scalable/apps/
-
-    ln -s $out/bin/tectonic $out/bin/nextonic
   '';
 
   doCheck = true;
@@ -50,6 +59,6 @@ rustPlatform.buildRustPackage rec {
     changelog = "https://github.com/tectonic-typesetting/tectonic/blob/tectonic@${version}/CHANGELOG.md";
     license = with licenses; [ mit ];
     mainProgram = "tectonic";
-    maintainers = with maintainers; [ lluchs doronbehar ];
+    maintainers = with maintainers; [ lluchs doronbehar bryango ];
   };
 }
diff --git a/nixpkgs/pkgs/tools/typesetting/tectonic/tests.nix b/nixpkgs/pkgs/tools/typesetting/tectonic/tests.nix
new file mode 100644
index 000000000000..0ecf47bf1977
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/tectonic/tests.nix
@@ -0,0 +1,87 @@
+# This package provides `tectonic.passthru.tests`.
+# It requires internet access to fetch tectonic's resource bundle on demand.
+
+{ lib
+, fetchFromGitHub
+, runCommand
+, tectonic
+, curl
+, cacert
+, emptyFile
+}:
+
+let
+  /*
+    Currently, the test files are only fully available from the `dev` branch of
+    `biber`. When https://github.com/plk/biber/pull/467 is eventually released,
+    we can obtain the test files from `texlive.pkgs.biber.texsource`. For now,
+    i.e. biber<=2.19, we fetch the test files directly from GitHub.
+  */
+  biber-dev-source = fetchFromGitHub {
+    owner = "plk";
+    repo = "biber";
+    # curl https://api.github.com/repos/plk/biber/pulls/467 | jq .merge_commit_sha
+    rev = "d43e352586f5c9f98f0331978ca9d0b908986e09";
+    hash = "sha256-Z5BdMteBouiDQasF6GZXkS//YzrZkcX1eLvKIQIBkBs=";
+  };
+  testfiles = "${biber-dev-source}/testfiles";
+
+  noNetNotice = builtins.toFile "tectonic-offline-notice" ''
+    # To fetch tectonic's web bundle, the tests require internet access,
+    # which is not available in the current environment.
+  '';
+  # `cacert` is required for tls connections
+  nativeBuildInputs = [ curl cacert tectonic ];
+  checkInternet = ''
+    if curl --head "bing.com"; then
+      set -e # continue to the tests defined below, fail on error
+    else
+      cat "${noNetNotice}"
+      cp "${emptyFile}" "$out"
+      exit # bail out gracefully when there is no internet, do not panic
+    fi
+  '';
+
+  networkRequiringTestPkg = name: script: runCommand
+    /*
+      Introduce dependence on `tectonic` in the test package name. Note that
+      adding `tectonic` to `nativeBuildInputs` is not enough to trigger
+      rebuilds for a fixed-output derivation. One must update its name or
+      output hash to induce a rebuild. This behavior is exactly the same as a
+      standard nixpkgs "fetcher" such as `fetchurl`.
+    */
+    "test-${lib.removePrefix "${builtins.storeDir}/" tectonic.outPath}-${name}"
+    {
+      /*
+        Make a fixed-output derivation, return an `emptyFile` with fixed hash.
+        These derivations are allowed to access the internet from within a
+        sandbox, which allows us to test the automatic download of resource
+        files in tectonic, as a side effect. The `tectonic.outPath` is included
+        in `name` to induce rebuild of this fixed-output derivation whenever
+        the `tectonic` derivation is updated.
+      */
+      inherit (emptyFile)
+        outputHashAlgo
+        outputHashMode
+        outputHash
+        ;
+      allowSubstitutes = false;
+      inherit nativeBuildInputs;
+    }
+    ''
+      ${checkInternet}
+      ${script}
+      cp "${emptyFile}" "$out"
+    '';
+
+in
+lib.mapAttrs networkRequiringTestPkg {
+  biber-compatibility = ''
+    # import the test files
+    cp "${testfiles}"/* .
+
+    # tectonic caches in the $HOME directory, so set it to $PWD
+    export HOME=$PWD
+    tectonic -X compile ./test.tex
+  '';
+}
diff --git a/nixpkgs/pkgs/tools/typesetting/tectonic/wrapper.nix b/nixpkgs/pkgs/tools/typesetting/tectonic/wrapper.nix
new file mode 100644
index 000000000000..f9e2f7eb59eb
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/tectonic/wrapper.nix
@@ -0,0 +1,58 @@
+{ lib
+, symlinkJoin
+, tectonic-unwrapped
+, biber-for-tectonic
+, makeWrapper
+, callPackage
+}:
+
+symlinkJoin {
+  name = "${tectonic-unwrapped.pname}-wrapped-${tectonic-unwrapped.version}";
+  paths = [ tectonic-unwrapped ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  passthru = {
+    unwrapped = tectonic-unwrapped;
+    biber = biber-for-tectonic;
+    tests = callPackage ./tests.nix { };
+  };
+
+  # Replace the unwrapped tectonic with the one wrapping it with biber
+  postBuild = ''
+    rm $out/bin/{tectonic,nextonic}
+  ''
+    # Ideally, we would have liked to also pin the version of the online TeX
+    # bundle that Tectonic's developer distribute, so that the `biber` version
+    # and the `biblatex` version distributed from there are compatible.
+    # However, that is not currently possible, due to lack of upstream support
+    # for specifying this in runtime, there were 2 suggestions sent upstream
+    # that suggested a way of improving the situation:
+    #
+    # - https://github.com/tectonic-typesetting/tectonic/pull/1132
+    # - https://github.com/tectonic-typesetting/tectonic/pull/1131
+    #
+    # The 1st suggestion seems more promising as it'd allow us to simply use
+    # makeWrapper's --add-flags option. However, the PR linked above is not
+    # complete, and as of currently, upstream hasn't even reviewed it, or
+    # commented on the idea.
+    #
+    # Note also that upstream has announced that they will put less time and
+    # energy for the project:
+    #
+    # https://github.com/tectonic-typesetting/tectonic/discussions/1122
+    #
+    # Hence, we can be rather confident that for the near future, the online
+    # TeX bundle won't be updated and hence the biblatex distributed there
+    # won't require a higher version of biber.
+  + ''
+    makeWrapper ${lib.getBin tectonic-unwrapped}/bin/tectonic $out/bin/tectonic \
+      --prefix PATH : "${lib.getBin biber-for-tectonic}/bin"
+    ln -s $out/bin/tectonic $out/bin/nextonic
+  '';
+
+  meta = tectonic-unwrapped.meta // {
+    description = "Tectonic TeX/LaTeX engine, wrapped with a compatible biber";
+    maintainers = with lib.maintainers; [ doronbehar bryango ];
+  };
+}