Files
nixpkgs/pkgs/mem0/default.nix
T
m3ta-chironandClaude Opus 5.5 f53130489e fix: make the flake evaluate on current nixpkgs
- Drop x86_64-darwin; nixpkgs 26.11 no longer supports it.
- Expose only packages available on each system (mem0 is Linux-only)
  and mark rofi-project-opener Linux-only.
- mem0: use posthog without its test suite; nixpkgs marks it broken
  only because the tests fail with mcp >= 2.
- devops shell: build fabric with invoke 3 so azure-cli evaluates;
  nixpkgs marks it broken over its invoke<3 pin and failing tests.
- Update flake inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:08:52 +01:00

110 lines
3.1 KiB
Nix

{
lib,
nix-update-script,
python3,
fetchFromGitHub,
}: let
# nixpkgs marks posthog broken because its test suite fails with mcp >= 2;
# the library itself works, so skip its tests instead.
posthog = python3.pkgs.posthog.overridePythonAttrs (old: {
doCheck = false;
meta = old.meta // {broken = false;};
});
in
python3.pkgs.buildPythonPackage rec {
pname = "mem0ai";
version = "2.0.2";
pyproject = true;
src = fetchFromGitHub {
owner = "mem0ai";
repo = "mem0";
rev = "v${version}";
hash = "sha256-SV/+v0WmR6iZyyhPIXtj0PcIpPlSclak0zuSsIGebUo=";
};
# Relax Python dependency version constraints
# mem0 has strict version pins that may not match nixpkgs versions
pythonRelaxDeps = true;
build-system = with python3.pkgs; [
hatchling
];
dependencies = with python3.pkgs; [
litellm
qdrant-client
pydantic
openai
posthog
pytz
sqlalchemy
protobuf
uvicorn
fastapi
];
optional-dependencies = with python3.pkgs; {
graph = [
# Note: some graph dependencies may not be available in nixpkgs
# neo4j is available, others will need to be packaged separately
];
vector_stores = [
# chromadb # available in nixpkgs
# pinecone-client # may need packaging
# weaviate-client # may need packaging
# faiss # available as faiss-cpu
psycopg
pymongo
pymysql
redis
elasticsearch
];
llms = [
groq
openai
# together # may need packaging
# litellm # may need packaging
# ollama # may need packaging
# google-generativeai # may need packaging
];
extras = [
boto3
# langchain-community # may need packaging
# sentence-transformers # may need packaging
elasticsearch
# fastembed # may need packaging
];
};
# Skip tests for now since they require additional test dependencies
doCheck = false;
# Disable imports check because mem0 tries to create directories at import time
# which fails in the Nix sandbox (/homeless-shelter)
pythonImportsCheck = [];
postInstall = ''
install -Dm755 ${./server.py} $out/bin/mem0-server
'';
passthru.updateScript = nix-update-script {};
meta = with lib; {
description = "Long-term memory layer for AI agents with REST API support";
longDescription = ''
Mem0 provides a sophisticated memory layer for AI applications, offering:
- Memory management for AI agents (add, search, update, delete)
- REST API server for easy integration
- Support for multiple vector storage backends (Qdrant, Chroma, etc.)
- Graph memory capabilities
- Multi-modal support
- Configurable LLM and embedding models
'';
homepage = "https://github.com/mem0ai/mem0";
changelog = "https://github.com/mem0ai/mem0/releases/tag/v${version}";
license = licenses.asl20;
platforms = platforms.linux;
};
}