This repository shows a minimal FastAPI workflow with:
nixfor reproducible system toolinguvfor Python dependency managementdockerimage builds from the Nix flake
- WSL (Ubuntu 24.04)
- Docker Desktop with WSL integration enabled
- Nix
Install Nix via Nix Installer:
curl -sSfL https://artifacts.nixos.org/nix-installer | sh -s -- installgit clone https://github.com/opsbr/sample-nix-uv-docker.git
cd sample-nix-uv-dockernix developAfter entering the shell, the Python virtual environment is active and uv is available.
fastapi devOpen http://127.0.0.1:8000 and you should see:
{"message":"Hello World"}Build the image via Nix:
nix buildThis uses flake.lock and uv.lock to pin both system and Python dependencies (via uv2nix).
Load and run the image:
docker load < result
docker run --rm -it -p 8000:8000 my-app:latest