diff --git a/pkgs/development/python-modules/xgrammar/default.nix b/pkgs/development/python-modules/xgrammar/default.nix index ef67d4b22abd..6a1a1549293f 100644 --- a/pkgs/development/python-modules/xgrammar/default.nix +++ b/pkgs/development/python-modules/xgrammar/default.nix @@ -11,6 +11,7 @@ scikit-build-core, # dependencies + mlx-lm, pydantic, sentencepiece, tiktoken, @@ -25,7 +26,7 @@ buildPythonPackage rec { pname = "xgrammar"; - version = "0.1.23"; + version = "0.1.24"; pyproject = true; src = fetchFromGitHub { @@ -33,7 +34,7 @@ buildPythonPackage rec { repo = "xgrammar"; tag = "v${version}"; fetchSubmodules = true; - hash = "sha256-asyxJsrsbfFNh1pLBDzM4kdmunQp7/mTDw3L8KuZf4g="; + hash = "sha256-K+GCHuWKF449JaGWr7FQrDeJS3pxmVKnGf68L53LrK0="; }; patches = [ @@ -57,6 +58,9 @@ buildPythonPackage rec { ] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) [ triton + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + mlx-lm ]; nativeCheckInputs = [ @@ -64,10 +68,10 @@ buildPythonPackage rec { writableTmpDirAsHomeHook ]; - NIX_CFLAGS_COMPILE = toString [ + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ # xgrammar hardcodes -flto=auto while using static linking, which can cause linker errors without this additional flag. "-ffat-lto-objects" - ]; + ]); disabledTests = [ # You are trying to access a gated repo. @@ -98,10 +102,6 @@ buildPythonPackage rec { badPlatforms = [ # error: ‘operator delete’ called on unallocated object ‘result’ [-Werror=free-nonheap-object] "aarch64-linux" - - # clang++: error: unsupported option '-ffat-lto-objects' for target 'arm64-apple-darwin' - # idem for 'x86_64-apple-darwin' - lib.systems.inspect.patterns.isDarwin ]; }; }