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

tectonic: lock --web-bundle for reproducible builds #1

Closed
wants to merge 3 commits into from
Closed
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
7 changes: 3 additions & 4 deletions pkgs/tools/typesetting/tectonic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@
, harfbuzz
, openssl
, pkg-config
, makeBinaryWrapper
, icu
}:

rustPlatform.buildRustPackage rec {
pname = "tectonic";
version = "0.14.1";
version = "0.15.0";

src = fetchFromGitHub {
owner = "tectonic-typesetting";
repo = "tectonic";
rev = "tectonic@${version}";
fetchSubmodules = true;
sha256 = "sha256-Cd8YzjU5mCA5DmgLBjg8eVRc87chVVIXinJuf8cNw3o=";
sha256 = "sha256-xZHYiaQ8ASUwu0ieHIXcjRaH06SQoB6OR1y7Ok+FjAs=";
};

cargoHash = "sha256-1WjZbmZFPB1+QYpjqq5Y+fDkMZNmWJYIxmMFWg7Tiac=";
cargoHash = "sha256-niMgb4zsTWHw5yaa4kJOZzpOzO5gMG4k3cTHwSV+wmY=";

nativeBuildInputs = [ pkg-config ];

Expand Down
8 changes: 7 additions & 1 deletion pkgs/tools/typesetting/tectonic/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

{ lib
, fetchFromGitHub
, writeText
, runCommand
, tectonic
, curl
Expand All @@ -26,7 +27,7 @@ let
};
testfiles = "${biber-dev-source}/testfiles";

noNetNotice = builtins.toFile "tectonic-offline-notice" ''
noNetNotice = writeText "tectonic-offline-notice" ''
# To fetch tectonic's web bundle, the tests require internet access,
# which is not available in the current environment.
'';
Expand Down Expand Up @@ -84,4 +85,9 @@ lib.mapAttrs networkRequiringTestPkg {
export HOME=$PWD
tectonic -X compile ./test.tex
'';

workspace = ''
tectonic -X new
cat Tectonic.toml | grep "${tectonic.bundle.url}"
'';
}
37 changes: 20 additions & 17 deletions pkgs/tools/typesetting/tectonic/wrapper.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
{ lib
, symlinkJoin
, tectonic
, tectonic-unwrapped
, biber-for-tectonic
, makeWrapper
, makeBinaryWrapper
, callPackage
}:

let

# The version locked tectonic web bundle, redirected from:
# https://relay.fullyjustified.net/default_bundle_v33.tar
# To check for updates, see:
# https://github.com/tectonic-typesetting/tectonic/blob/master/crates/bundles/src/lib.rs
# ... and look up `get_fallback_bundle_url`.
TECTONIC_WEB_BUNDLE_LOCKED = "https://data1.fullyjustified.net/tlextras-2022.0r0.tar";

in

symlinkJoin {
name = "${tectonic-unwrapped.pname}-wrapped-${tectonic-unwrapped.version}";
paths = [ tectonic-unwrapped ];

nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ makeBinaryWrapper ];

passthru = {
unwrapped = tectonic-unwrapped;
biber = biber-for-tectonic;
tests = callPackage ./tests.nix { };
bundle.url = TECTONIC_WEB_BUNDLE_LOCKED;
};

# 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.
# 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.
#
# Note also that upstream has announced that they will put less time and
# energy for the project:
Expand All @@ -47,7 +49,8 @@ symlinkJoin {
# 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"
--prefix PATH : "${lib.getBin biber-for-tectonic}/bin" \
--add-flags "--web-bundle ${tectonic.passthru.bundle.url}"
ln -s $out/bin/tectonic $out/bin/nextonic
'';

Expand Down