{ lib, python3Packages, fetchFromGitHub, pyright, fortls, oraios-pywebview, }: # TODO: We can just get this from nixpkgs when merged: https://github.com/NixOS/nixpkgs/pull/506300 python3Packages.buildPythonApplication (finalAttrs: { pname = "serena"; version = "1.1.2"; pyproject = true; disabled = python3Packages.pythonOlder "3.11"; src = fetchFromGitHub { owner = "oraios"; repo = "serena"; tag = "v${finalAttrs.version}"; hash = "sha256-3MPlJvXt83C7dBxYrCe1or3UYWMZ1poSg3PBmVXj0mA="; }; postPatch = '' # Remove the deprecated dotenv stub package (serena uses python-dotenv) substituteInPlace pyproject.toml \ --replace-fail '"dotenv==0.9.9",' "" # Remove pyright from Python dependencies and make it available at runtime # instead substituteInPlace pyproject.toml \ --replace-fail '"pyright==1.1.403",' "" # Remove fortls from Python dependencies and make it available at runtime instead substituteInPlace pyproject.toml \ --replace-fail '"fortls==3.2.2",' "" ''; build-system = [ python3Packages.hatchling ]; pythonRelaxDeps = true; makeWrapperArgs = [ "--prefix PATH : ${ lib.makeBinPath [ pyright fortls ] }" ]; dependencies = [ oraios-pywebview ] ++ (with python3Packages; [ anthropic docstring-parser beautifulsoup4 cryptography flask jinja2 joblib mcp overrides pathspec psutil pydantic pystray python-dotenv pyyaml requests ruamel-yaml sensai-utils tiktoken tqdm types-pyyaml ]); optional-dependencies = with python3Packages; { google = [ google-genai ]; }; pythonImportsCheck = [ "serena" ]; })