1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cargo,
6 fetchFromGitHub,
7 openssl,
8 pkg-config,
9 pythonOlder,
10 rustc,
11 rustPlatform,
12}:
13
14buildPythonPackage rec {
15 pname = "typst";
16 version = "0.13.2";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "messense";
23 repo = "typst-py";
24 tag = "v${version}";
25 hash = "sha256-Cqi8GupcC7n/OfiFLrNXw0ydXpOqOpWTgIGJXdib5L8=";
26 };
27
28 cargoDeps = rustPlatform.fetchCargoVendor {
29 inherit src;
30 name = "${pname}-${version}";
31 hash = "sha256-bcO+irLT4Sy8IZ/YQZFD2jVjZAUCO0j+TitigHo4xbM=";
32 };
33
34 build-system = [
35 cargo
36 pkg-config
37 rustPlatform.cargoSetupHook
38 rustPlatform.maturinBuildHook
39 rustc
40 ];
41
42 buildInputs = [ openssl ];
43
44 pythonImportsCheck = [ "typst" ];
45
46 env = {
47 OPENSSL_NO_VENDOR = true;
48 };
49
50 # Module has no tests
51 doCheck = false;
52
53 meta = {
54 description = "Python binding to typst";
55 homepage = "https://github.com/messense/typst-py";
56 changelog = "https://github.com/messense/typst-py/releases/tag/v${version}";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maintainers; [ fab ];
59 };
60}