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.7";
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-kbdYiWix1gDZPTkmjtrSRV/g60bLKxGbv776ezPaSCA=";
26 };
27
28 cargoDeps = rustPlatform.fetchCargoVendor {
29 inherit pname version src;
30 hash = "sha256-IhTrGAgGgSPCD1d3pblCOME0AHv5GMV9xRUNSGTXEws=";
31 };
32
33 build-system = [
34 cargo
35 pkg-config
36 rustPlatform.cargoSetupHook
37 rustPlatform.maturinBuildHook
38 rustc
39 ];
40
41 buildInputs = [ openssl ];
42
43 pythonImportsCheck = [ "typst" ];
44
45 env = {
46 OPENSSL_NO_VENDOR = true;
47 };
48
49 # Module has no tests
50 doCheck = false;
51
52 meta = {
53 description = "Python binding to typst";
54 homepage = "https://github.com/messense/typst-py";
55 changelog = "https://github.com/messense/typst-py/releases/tag/v${version}";
56 license = lib.licenses.asl20;
57 maintainers = with lib.maintainers; [ fab ];
58 };
59}