From 17fbeffac18a3b1c6b68a5e42ba8b8c9dd8d9881 Mon Sep 17 00:00:00 2001 From: Wong Ding Feng Date: Sun, 19 Apr 2026 12:18:32 +0800 Subject: [PATCH] init: LightRAG + Graphiti as submodules with Nix flake Impure devShells using uv + Python 3.12 for each project. LD_LIBRARY_PATH set for NixOS native wheel compatibility. Neo4j managed via nix run .#neo4j-start / neo4j-stop. Co-Authored-By: Claude Sonnet 4.6 --- .env.graphiti | 14 +++++++ .env.lightrag | 18 ++++++++ .gitignore | 5 +++ .gitmodules | 6 +++ flake.lock | 27 ++++++++++++ flake.nix | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ graphiti | 1 + lightrag | 1 + 8 files changed, 186 insertions(+) create mode 100644 .env.graphiti create mode 100644 .env.lightrag create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 flake.lock create mode 100644 flake.nix create mode 160000 graphiti create mode 160000 lightrag diff --git a/.env.graphiti b/.env.graphiti new file mode 100644 index 0000000..5a7d161 --- /dev/null +++ b/.env.graphiti @@ -0,0 +1,14 @@ +# Neo4j (started via: nix run .#neo4j-start) +NEO4J_URI=bolt://localhost:7687 +NEO4J_USER=neo4j +NEO4J_PASSWORD=neo4j + +# LLM via Ollama (OpenAI-compatible) +OPENAI_API_KEY=ollama +OPENAI_BASE_URL=http://localhost:11434/v1 +MODEL_NAME=qwen2.5:7b + +# Embeddings via Ollama +# nomic-embed-text dim=768, mxbai-embed-large dim=1024 +EMBEDDING_MODEL=nomic-embed-text +EMBEDDING_DIM=768 diff --git a/.env.lightrag b/.env.lightrag new file mode 100644 index 0000000..34f7fe3 --- /dev/null +++ b/.env.lightrag @@ -0,0 +1,18 @@ +# LLM via Ollama +LLM_BINDING=ollama +LLM_MODEL=qwen2.5:7b +LLM_BINDING_HOST=http://localhost:11434 + +# Embeddings via Ollama +EMBEDDING_BINDING=ollama +EMBEDDING_MODEL=nomic-embed-text +EMBEDDING_BINDING_HOST=http://localhost:11434 +EMBEDDING_DIM=768 + +# Storage (local files) +RAG_DIR=./rag_storage + +# Server +HOST=0.0.0.0 +PORT=9621 +WORKERS=1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..34bea5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +data/ +.venv/ +__pycache__/ +*.pyc +.env.*.local diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0c0869b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "lightrag"] + path = lightrag + url = https://github.com/hkuds/lightrag +[submodule "graphiti"] + path = graphiti + url = https://github.com/getzep/graphiti diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..682004d --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1776169885, + "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..37128ff --- /dev/null +++ b/flake.nix @@ -0,0 +1,114 @@ +{ + description = "LightRAG + Graphiti dev environments"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + + startNeo4j = pkgs.writeShellScript "start-neo4j" '' + set -e + : "''${RAGS_ROOT:=$PWD}" + NEO4J_DATA="$RAGS_ROOT/data/neo4j" + mkdir -p "$NEO4J_DATA"/{data,logs,run,plugins,import,conf} + + cat > "$NEO4J_DATA/conf/neo4j.conf" <