diff --git a/flake.nix b/flake.nix index dfa32d4..45c4cb3 100644 --- a/flake.nix +++ b/flake.nix @@ -11,25 +11,24 @@ let pkgs = nixpkgs.legacyPackages.${system}; - # Python 3.13 (zelfde versie als ansible gebruikt, voorkomt PATH-conflicten) pythonEnv = pkgs.python313.withPackages (ps: with ps; [ - # Conversie-pipeline (PRD: Technische Stack) + # Conversie-pipeline lxml # BWB XML-parsing met XPath/XSLT - pygit2 # Git-operaties via libgit2 (performanter dan GitPython) + pygit2 # Git-operaties via libgit2 pyyaml # YAML frontmatter generatie python-frontmatter # Markdown + YAML frontmatter parsing - # API-laag (PRD: FastAPI) + # API-laag fastapi uvicorn # ASGI server httpx # Async HTTP client (SRU-API, EUR-Lex) pydantic # Data validatie - # Achtergrondtaken (PRD: Celery + Redis) + # Achtergrondtaken celery redis # Python Redis client - # CLI-tool (PRD: wetgit CLI) + # CLI-tool click rich # Terminal formatting @@ -43,9 +42,6 @@ ruff mypy pip - setuptools - wheel - build # Typing stubs types-requests @@ -57,10 +53,10 @@ name = "wetgit"; buildInputs = with pkgs; [ - # Python environment + # Python environment (alle packages via nix, geen venv nodig) pythonEnv - # Dependency management + # Dependency management (voor PyPI-only packages) uv # Ansible (infrastructuur provisioning Hetzner) @@ -85,31 +81,27 @@ shellHook = '' echo "WetGit - Nederlandse wetgeving als code" - echo "" echo "Python: $(python --version)" - echo "Ansible: $(ansible --version 2>/dev/null | head -1)" - echo "hcloud: $(hcloud version 2>/dev/null)" - echo "" - echo "Pipeline tools: lxml, pygit2, fastapi" - echo "Infra tools: ansible, hcloud" echo "" - # Laad .env als die bestaat (API keys, Hetzner token) + # Deactiveer eventuele oude venv die in de weg zit + if [ -n "$VIRTUAL_ENV" ]; then + deactivate 2>/dev/null || true + fi + + # PYTHONPATH zodat 'import wetgit' werkt vanuit src/ + export PYTHONPATH="$PWD/src''${PYTHONPATH:+:$PYTHONPATH}" + + # .env laden (API keys, Hetzner token) if [ -f .env ]; then set -a source .env set +a - echo "Loaded environment from .env" - echo "" fi - # PYTHONPATH voor lokale wetgit package - export PYTHONPATH="$PWD/src:$PYTHONPATH" - - # PyPI-only packages (niet in nixpkgs) installeren in user site + # PyPI-only packages (niet in nixpkgs) if ! python -c "import agentmail" 2>/dev/null; then - pip install --user --quiet agentmail - echo "Installed agentmail via pip --user" + pip install --user --quiet agentmail 2>/dev/null fi ''; };