- history.py: reconstrueert volledige versiehistorie per regeling - sru_client.py: fetch_all_toestanden() voor alle versies per BWB-ID - Git commits met correcte author date (inwerkingtredings-datum) - flake.nix: venv vervangen door PYTHONPATH + pip --user Pilot: Grondwet (BWBR0001840) — 11 toestanden, 11 commits, 0 failures. git diff toont exacte wetswijzigingen (bijv. art. 131 Grondwet). Sluit #28, #29, #30, #31
117 lines
3.2 KiB
Nix
117 lines
3.2 KiB
Nix
{
|
|
description = "WetGit - Nederlandse wetgeving als code";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
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)
|
|
lxml # BWB XML-parsing met XPath/XSLT
|
|
pygit2 # Git-operaties via libgit2 (performanter dan GitPython)
|
|
pyyaml # YAML frontmatter generatie
|
|
python-frontmatter # Markdown + YAML frontmatter parsing
|
|
|
|
# API-laag (PRD: FastAPI)
|
|
fastapi
|
|
uvicorn # ASGI server
|
|
httpx # Async HTTP client (SRU-API, EUR-Lex)
|
|
pydantic # Data validatie
|
|
|
|
# Achtergrondtaken (PRD: Celery + Redis)
|
|
celery
|
|
redis # Python Redis client
|
|
|
|
# CLI-tool (PRD: wetgit CLI)
|
|
click
|
|
rich # Terminal formatting
|
|
|
|
# Testing
|
|
pytest
|
|
pytest-cov
|
|
pytest-asyncio
|
|
|
|
# Development tools
|
|
black
|
|
ruff
|
|
mypy
|
|
pip
|
|
setuptools
|
|
wheel
|
|
build
|
|
|
|
# Typing stubs
|
|
types-requests
|
|
types-pyyaml
|
|
]);
|
|
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
name = "wetgit";
|
|
|
|
buildInputs = with pkgs; [
|
|
# Python environment
|
|
pythonEnv
|
|
|
|
# Dependency management
|
|
uv
|
|
|
|
# Ansible (infrastructuur provisioning Hetzner)
|
|
ansible
|
|
ansible-lint
|
|
|
|
# Hetzner Cloud CLI
|
|
hcloud
|
|
|
|
# Redis server (lokale development)
|
|
redis
|
|
|
|
# Git & tools
|
|
git
|
|
jq
|
|
yq-go
|
|
curl
|
|
|
|
# Native dependencies voor pygit2
|
|
libgit2
|
|
];
|
|
|
|
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)
|
|
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
|
|
if ! python -c "import agentmail" 2>/dev/null; then
|
|
pip install --user --quiet agentmail
|
|
echo "Installed agentmail via pip --user"
|
|
fi
|
|
'';
|
|
};
|
|
});
|
|
}
|