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>2024-01-03 18:00:57 +0000
committerGitHub <noreply@github.com>2024-01-03 18:00:57 +0000
commit307002948de4dd54437293de0d6a629d5478668b (patch)
treec4ac4efe50b0f73c3d08f9b470e955d047a106ad /pkgs/tools/typesetting
parentdc84f218497ff60740617d5e9e7df0432c495c3e (diff)
parent5f23a2f3961d7878e3c28d1d5535afff3ac3aac0 (diff)
downloadnixlib-307002948de4dd54437293de0d6a629d5478668b.tar
nixlib-307002948de4dd54437293de0d6a629d5478668b.tar.gz
nixlib-307002948de4dd54437293de0d6a629d5478668b.tar.bz2
nixlib-307002948de4dd54437293de0d6a629d5478668b.tar.lz
nixlib-307002948de4dd54437293de0d6a629d5478668b.tar.xz
nixlib-307002948de4dd54437293de0d6a629d5478668b.tar.zst
nixlib-307002948de4dd54437293de0d6a629d5478668b.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/tools/typesetting')
-rw-r--r--pkgs/tools/typesetting/asciidoctorj/default.nix4
-rw-r--r--pkgs/tools/typesetting/hayagriva/default.nix6
-rw-r--r--pkgs/tools/typesetting/tectonic/tests.nix87
-rw-r--r--pkgs/tools/typesetting/tectonic/wrapper.nix2
4 files changed, 94 insertions, 5 deletions
diff --git a/pkgs/tools/typesetting/asciidoctorj/default.nix b/pkgs/tools/typesetting/asciidoctorj/default.nix
index 91ce383f9a4d..fd2bc2eabdb8 100644
--- a/pkgs/tools/typesetting/asciidoctorj/default.nix
+++ b/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/pkgs/tools/typesetting/hayagriva/default.nix b/pkgs/tools/typesetting/hayagriva/default.nix
index 2a49d0b727ed..03aea70ae6cf 100644
--- a/pkgs/tools/typesetting/hayagriva/default.nix
+++ b/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/pkgs/tools/typesetting/tectonic/tests.nix b/pkgs/tools/typesetting/tectonic/tests.nix
new file mode 100644
index 000000000000..0ecf47bf1977
--- /dev/null
+++ b/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/pkgs/tools/typesetting/tectonic/wrapper.nix b/pkgs/tools/typesetting/tectonic/wrapper.nix
index 5a4dc47e37a2..f9e2f7eb59eb 100644
--- a/pkgs/tools/typesetting/tectonic/wrapper.nix
+++ b/pkgs/tools/typesetting/tectonic/wrapper.nix
@@ -3,6 +3,7 @@
 , tectonic-unwrapped
 , biber-for-tectonic
 , makeWrapper
+, callPackage
 }:
 
 symlinkJoin {
@@ -14,6 +15,7 @@ symlinkJoin {
   passthru = {
     unwrapped = tectonic-unwrapped;
     biber = biber-for-tectonic;
+    tests = callPackage ./tests.nix { };
   };
 
   # Replace the unwrapped tectonic with the one wrapping it with biber