From dfe57d7ade2ee48471300582da1d0c683b219532 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sat, 29 Nov 2025 10:52:45 -0800 Subject: [PATCH 1/3] python3Packages.gguf: modernize Modernize structure, build from github source, enable tests. --- .../python-modules/gguf/default.nix | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/gguf/default.nix b/pkgs/development/python-modules/gguf/default.nix index d1bdd9313a7b..aa36e03af5b1 100644 --- a/pkgs/development/python-modules/gguf/default.nix +++ b/pkgs/development/python-modules/gguf/default.nix @@ -1,40 +1,54 @@ { lib, buildPythonPackage, - fetchPypi, - pythonOlder, - numpy, + fetchFromGitHub, + + # build-system poetry-core, + + # dependencies + numpy, + pyside6, pyyaml, sentencepiece, tqdm, + + # check inputs + pytestCheckHook, }: + buildPythonPackage rec { pname = "gguf"; version = "0.17.1"; - format = "pyproject"; + pyproject = true; - disabled = pythonOlder "3.7"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-Nq1xqtkAo+dfyU6+lupgKfA6TkS+difvetPQPox7y1M="; + src = fetchFromGitHub { + owner = "ggml-org"; + repo = "llama.cpp"; + tag = "gguf-v${version}"; + hash = "sha256-XjDMDca4pyc72WQee4h3R6Iq9M0LzO+6ukV6CBWQO1M="; }; + sourceRoot = "${src.name}/gguf-py"; + + build-system = [ poetry-core ]; + dependencies = [ numpy - poetry-core + pyside6 pyyaml sentencepiece tqdm ]; + nativeCheckInputs = [ pytestCheckHook ]; + pythonImportsCheck = [ "gguf" ]; - meta = with lib; { + meta = { description = "Module for writing binary files in the GGUF format"; homepage = "https://ggml.ai/"; - license = licenses.mit; - maintainers = with maintainers; [ mitchmindtree ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mitchmindtree ]; }; } From 666ded3f8e29af68f833cf3291b06a6d9f663bca Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sat, 29 Nov 2025 11:21:09 -0800 Subject: [PATCH 2/3] python3Packages.gguf: add sarahec as maintainer --- pkgs/development/python-modules/gguf/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/gguf/default.nix b/pkgs/development/python-modules/gguf/default.nix index aa36e03af5b1..4bddf387d180 100644 --- a/pkgs/development/python-modules/gguf/default.nix +++ b/pkgs/development/python-modules/gguf/default.nix @@ -49,6 +49,9 @@ buildPythonPackage rec { description = "Module for writing binary files in the GGUF format"; homepage = "https://ggml.ai/"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ mitchmindtree ]; + maintainers = with lib.maintainers; [ + mitchmindtree + sarahec + ]; }; } From 9dea22dd33dca2b4b1d645dfae9a0c39fbcdd42d Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sat, 29 Nov 2025 11:15:25 -0800 Subject: [PATCH 3/3] python3Packages.gguf: exclude optional sentencepiece on Darwin Revert this once sentencepiece is fixed, see https://github.com/NixOS/nixpkgs/issues/466092 --- pkgs/development/python-modules/gguf/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/gguf/default.nix b/pkgs/development/python-modules/gguf/default.nix index 4bddf387d180..15b619f8374d 100644 --- a/pkgs/development/python-modules/gguf/default.nix +++ b/pkgs/development/python-modules/gguf/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, @@ -37,8 +38,12 @@ buildPythonPackage rec { numpy pyside6 pyyaml - sentencepiece tqdm + ] + # Sentencepiece is optional and its inclusion crashes darwin + # See https://github.com/NixOS/nixpkgs/issues/466092 + ++ lib.optionals stdenv.hostPlatform.isLinux [ + sentencepiece ]; nativeCheckInputs = [ pytestCheckHook ];