Try a different tack...
This commit is contained in:
parent
931c60ee57
commit
00bc4d1da7
@ -57,15 +57,6 @@ in {
|
||||
after = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
reloadIfChanged = true;
|
||||
path = with pkgs.python310Packages; [
|
||||
pkgs.python310
|
||||
gunicorn
|
||||
fastapi
|
||||
gunicorn
|
||||
opencv4
|
||||
python-multipart
|
||||
uvicorn
|
||||
];
|
||||
environment = {
|
||||
OBJECTIFIER_YOLOV3_CONFIG = "${pkgs.yolov3-data}/yolov3.cfg";
|
||||
OBJECTIFIER_YOLOV3_WEIGHTS = "${pkgs.yolov3-data}/yolov3.weights";
|
||||
@ -74,6 +65,7 @@ in {
|
||||
OBJECTIFIER_CLEANUP_MAX_AGE = toString cfg.cleanup.max_file_age;
|
||||
OBJECTIFIER_CLEANUP_DELAY = toString cfg.cleanup.delay;
|
||||
};
|
||||
path = [ pkgs.objectifier ];
|
||||
serviceConfig = {
|
||||
# PrivateUsers = true;
|
||||
# PrivateDevices = true;
|
||||
@ -103,12 +95,10 @@ in {
|
||||
(map (addr: "--bind ${addr}:${toString cfg.port}")
|
||||
cfg.listen-addresses);
|
||||
in (concatStringsSep " " [
|
||||
"gunicorn"
|
||||
"objectifier"
|
||||
bindClause
|
||||
"--workers ${toString cfg.workers}"
|
||||
"-k uvicorn.workers.UvicornWorker"
|
||||
"--pid /run/objectifier.pid"
|
||||
"objectifier:app"
|
||||
]);
|
||||
};
|
||||
};
|
||||
|
@ -1,12 +1,33 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
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/yolo-cli.py $out/objectifier.py
|
||||
'';
|
||||
};
|
||||
|
||||
pythonYolo = pkgs.python3.withPackages (pyPkgs:
|
||||
with pyPkgs; [
|
||||
gunicorn
|
||||
fastapi
|
||||
gunicorn
|
||||
opencv4
|
||||
python-multipart
|
||||
uvicorn
|
||||
]);
|
||||
in pkgs.writeShellApplication {
|
||||
name = "objectifier";
|
||||
src = ./src;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp $src/detector.py $out/detector.py
|
||||
cp $src/yolo-cli.py $out/objectifier.py
|
||||
'';
|
||||
runtimeInputs = [ pythonYolo ];
|
||||
text = pkgs.lib.concatStringsSep " " [
|
||||
"gunicorn"
|
||||
"objectifier:app"
|
||||
"-k uvicorn.workers.UvicornWorker"
|
||||
''"$@"''
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user