about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/ollama/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/ollama/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/ollama/default.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/ollama/default.nix b/nixpkgs/pkgs/development/python-modules/ollama/default.nix
new file mode 100644
index 000000000000..5e46474e1129
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/ollama/default.nix
@@ -0,0 +1,64 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, httpx
+, pillow
+, poetry-core
+, pytest-asyncio
+, pytest-httpserver
+, pytestCheckHook
+, pythonOlder
+, pythonRelaxDepsHook
+}:
+
+buildPythonPackage rec {
+  pname = "ollama";
+  version = "0.1.7";
+  pyproject = true;
+
+  disabled = pythonOlder "3.8";
+
+  src = fetchFromGitHub {
+    owner = "ollama";
+    repo = "ollama-python";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-xNH9kAjSdVXrCI7zkyR7tYxJ/NG8/08ykkDZQJI8Za4=";
+  };
+
+  postPatch = ''
+    substituteInPlace pyproject.toml \
+      --replace-fail "0.0.0" "${version}"
+  '';
+
+  pythonRelaxDeps = [
+    "httpx"
+  ];
+
+  nativeBuildInputs = [
+    poetry-core
+    pythonRelaxDepsHook
+  ];
+
+  propagatedBuildInputs = [
+    httpx
+  ];
+
+  nativeCheckInputs = [
+    pillow
+    pytest-asyncio
+    pytest-httpserver
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [
+    "ollama"
+  ];
+
+  meta = with lib; {
+    description = "Ollama Python library";
+    homepage = "https://github.com/ollama/ollama-python";
+    changelog = "https://github.com/ollama/ollama-python/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ fab ];
+  };
+}