From 1c27c12e19291e598de71533963d8f7907e93062 Mon Sep 17 00:00:00 2001 From: "Markus S. Wamser" Date: Thu, 27 Feb 2025 09:01:12 +0100 Subject: [PATCH] typst: fix high cpu load when using `typst watch` This adopts a merged PR from upstream to fix the issue until a new release is provided by upstream. Upstream PR: https://github.com/typst/typst/pull/5905 --- pkgs/by-name/ty/typst/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/ty/typst/package.nix b/pkgs/by-name/ty/typst/package.nix index 854d4edf7e4b..f124c0e4c86c 100644 --- a/pkgs/by-name/ty/typst/package.nix +++ b/pkgs/by-name/ty/typst/package.nix @@ -2,6 +2,7 @@ lib, rustPlatform, fetchFromGitHub, + fetchpatch, installShellFiles, pkg-config, openssl, @@ -24,6 +25,16 @@ rustPlatform.buildRustPackage rec { useFetchCargoVendor = true; cargoHash = "sha256-ey5pFGLgj17+RZGjpLOeN7Weh29jJyvuRrJ8wsIlC58="; + patches = [ + (fetchpatch { + # typst 0.13.0 has a regression regarding usage of inotify when running `typst watch` + # also affects NixOS: https://github.com/typst/typst/issues/5903#issuecomment-2680985045 + name = "fix-high-cpu-in-watch-mode.patch"; + url = "https://patch-diff.githubusercontent.com/raw/typst/typst/pull/5905.patch"; + hash = "sha256-qq5Dj5kKSjdlHp8FOH+gQtzZGqzBscvG8ufSrL94tsY="; + }) + ]; + nativeBuildInputs = [ installShellFiles pkg-config