{ pkgs, lib, ... }: let objectifier-src = pkgs.stdenv.mkDerivation { name = "objectifier"; src = ./src; phases = [ "installPhase" ]; installPhase = '' mkdir -p $out cp $src/detector.py $out/detector.py cp $src/objectifier.py $out/objectifier.py ''; }; pythonYolo = pkgs.python3.withPackages (pyPkgs: with pyPkgs; [ gunicorn fastapi gunicorn opencv4 python-multipart uvicorn ]); in pkgs.writeShellApplication { name = "objectifier"; runtimeInputs = [ pythonYolo ]; text = let script = pkgs.lib.concatStringsSep " " [ "gunicorn" "objectifier:app" "-k uvicorn.workers.UvicornWorker" ''"$@"'' ]; in '' export CACHE_DIRECTORY STATE_DIRECTORY export PYTHONPATH="${objectifier-src}" ${script} ''; }