chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ty / typst / package.nix
blobde06edfee2f3618cbb4fda1b770816fa22bdfee4
1 { lib
2 , rustPlatform
3 , fetchFromGitHub
4 , installShellFiles
5 , pkg-config
6 , openssl
7 , xz
8 , stdenv
9 , darwin
10 , nix-update-script
13 rustPlatform.buildRustPackage rec {
14   pname = "typst";
15   version = "0.11.1";
17   src = fetchFromGitHub {
18     owner = "typst";
19     repo = "typst";
20     rev = "v${version}";
21     hash = "sha256-FagjVU8BJZStE/geexZERuV2P28iF/pPn2mTi1Gu9iU=";
22   };
24   cargoLock = {
25     lockFile = ./Cargo.lock;
26     outputHashes = {
27       "typst-dev-assets-0.11.1" = "sha256-SMRtitDHFpdMEoOuPBnC3RBTyZ96hb4KmMSCXpAyKfU=";
28     };
29   };
31   nativeBuildInputs = [
32     installShellFiles
33     pkg-config
34   ];
36   buildInputs = [
37     openssl
38     xz
39   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
40     darwin.apple_sdk.frameworks.CoreFoundation
41     darwin.apple_sdk.frameworks.CoreServices
42     darwin.apple_sdk.frameworks.Security
43   ];
45   env = {
46     GEN_ARTIFACTS = "artifacts";
47     OPENSSL_NO_VENDOR = true;
48   };
50   postPatch = ''
51     # Fix for "Found argument '--test-threads' which wasn't expected, or isn't valid in this context"
52     substituteInPlace tests/src/tests.rs --replace-fail 'ARGS.num_threads' 'ARGS.test_threads'
53     substituteInPlace tests/src/args.rs --replace-fail 'num_threads' 'test_threads'
55     # Fix build with Rust 1.80; remove on next release
56     ln -sf ${./Cargo.lock} Cargo.lock
57   '';
59   postInstall = ''
60     installManPage crates/typst-cli/artifacts/*.1
61     installShellCompletion \
62       crates/typst-cli/artifacts/typst.{bash,fish} \
63       --zsh crates/typst-cli/artifacts/_typst
64   '';
66   cargoTestFlags = [ "--workspace" ];
68   passthru.updateScript = nix-update-script { };
70   meta = {
71     changelog = "https://github.com/typst/typst/releases/tag/${src.rev}";
72     description = "New markup-based typesetting system that is powerful and easy to learn";
73     homepage = "https://github.com/typst/typst";
74     license = lib.licenses.asl20;
75     mainProgram = "typst";
76     maintainers = with lib.maintainers; [ drupol figsoda kanashimia ];
77   };