mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
Changelog: https://github.com/typst/typst/releases/tag/v0.15.1 Diff: https://github.com/typst/typst/compare/v0.15.0...v0.15.1
91 lines
2.1 KiB
Nix
91 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
pkg-config,
|
|
openssl,
|
|
nix-update-script,
|
|
versionCheckHook,
|
|
callPackage,
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
pname = "typst";
|
|
version = "0.15.1";
|
|
__structuredAttrs = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "typst";
|
|
repo = "typst";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-Z0DM/fBKIvA8y53GUlPrgthnXfOFbnzuPCOM9/ssrI8=";
|
|
leaveDotGit = true;
|
|
postFetch = ''
|
|
cd $out
|
|
git rev-parse HEAD > COMMIT
|
|
rm -rf .git
|
|
'';
|
|
};
|
|
|
|
cargoHash = "sha256-+/2L4o9d8UENPtJAD/sSqf5ysOfHJYZgnvhOAoRdK40=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
openssl
|
|
];
|
|
|
|
env = {
|
|
GEN_ARTIFACTS = "artifacts";
|
|
OPENSSL_NO_VENDOR = true;
|
|
};
|
|
|
|
# Fix for "Found argument '--test-threads' which wasn't expected, or isn't valid in this context"
|
|
postPatch = ''
|
|
substituteInPlace tests/src/tests.rs --replace-fail \
|
|
'ARGS.num_threads' \
|
|
'ARGS.test_threads'
|
|
substituteInPlace tests/src/args.rs --replace-fail \
|
|
'num_threads' \
|
|
'test_threads'
|
|
|
|
export TYPST_COMMIT_SHA="$(cat COMMIT | cut -c1-8)"
|
|
'';
|
|
|
|
postInstall = ''
|
|
installManPage crates/typst-cli/artifacts/*.1
|
|
installShellCompletion \
|
|
crates/typst-cli/artifacts/typst.{bash,fish} \
|
|
--zsh crates/typst-cli/artifacts/_typst
|
|
'';
|
|
|
|
cargoTestFlags = [ "--workspace" ];
|
|
|
|
doInstallCheck = true;
|
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
packages = callPackage ./typst-packages.nix { };
|
|
wrapper = callPackage ./wrapper.nix { };
|
|
withPackages = ps: finalAttrs.passthru.wrapper { packages = ps; };
|
|
};
|
|
|
|
meta = {
|
|
changelog = "https://github.com/typst/typst/releases/tag/${finalAttrs.src.tag}";
|
|
description = "New markup-based typesetting system that is powerful and easy to learn";
|
|
homepage = "https://github.com/typst/typst";
|
|
license = lib.licenses.asl20;
|
|
mainProgram = "typst";
|
|
maintainers = with lib.maintainers; [
|
|
kanashimia
|
|
RossSmyth
|
|
faukah
|
|
];
|
|
};
|
|
})
|