Skip to content

This repository shows a minimal FastAPI workflow with nix, uv and docker.

License

Notifications You must be signed in to change notification settings

opsbr/sample-nix-uv-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample: Nix + uv + Docker

This repository shows a minimal FastAPI workflow with:

  • nix for reproducible system tooling
  • uv for Python dependency management
  • docker image builds from the Nix flake

Prerequisites

  • 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 -- install

Quickstart

1. Clone

git clone https://github.com/opsbr/sample-nix-uv-docker.git
cd sample-nix-uv-docker

2. Enter development shell

nix develop

After entering the shell, the Python virtual environment is active and uv is available.

3. Run the app locally

fastapi dev

Open http://127.0.0.1:8000 and you should see:

{"message":"Hello World"}

Build and run with Docker

Build the image via Nix:

nix build

This 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

About

This repository shows a minimal FastAPI workflow with nix, uv and docker.

Resources

License

Stars

Watchers

Forks