From 363f642bff73addf08a8d42912e479cd93fcfd76 Mon Sep 17 00:00:00 2001 From: ahtlon Date: Sun, 12 Apr 2026 21:55:13 +0200 Subject: [PATCH] Set up nix-shell + fastapi base --- .gitignore | 1 + main.py | 7 +++++++ shell.nix | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 .gitignore create mode 100644 main.py create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/main.py b/main.py new file mode 100644 index 0000000..8e3dfea --- /dev/null +++ b/main.py @@ -0,0 +1,7 @@ +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +async def root(): + return {"message": "Hello World"} \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..d9378c7 --- /dev/null +++ b/shell.nix @@ -0,0 +1,17 @@ +# run with "nix develop -f shell.nix" +let + # We pin to a specific nixpkgs commit for reproducibility. + # Last updated: 2026-04-12. Check for new commits at https://status.nixos.org. + pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/54170c54449ea4d6725efd30d719c5e505f1c10e.tar.gz") {}; +in pkgs.mkShell { + packages = [ + (pkgs.python3.withPackages (python-pkgs: with python-pkgs; [ + # select Python packages here + fastapi + pydantic + sqlalchemy + uvicorn + ])) + pkgs.fastapi-cli + ]; +} \ No newline at end of file