10 python = python3.override {
14 python.pkgs.buildPythonApplication rec {
15 pname = "immich-machine-learning";
16 inherit (immich) version;
17 src = "${immich.src}/machine-learning";
25 build-system = with python.pkgs; [
34 opencv-python-headless
49 ++ uvicorn.optional-dependencies.standard;
51 # aarch64-linux tries to get cpu information from /sys, which isn't available
52 # inside the nix build sandbox.
53 doCheck = stdenv.buildPlatform.system != "aarch64-linux";
55 nativeCheckInputs = with python.pkgs; [
63 mkdir -p $out/share/immich
64 cp log_conf.json $out/share/immich
66 cp -r ann $out/${python.sitePackages}/
68 makeWrapper ${lib.getExe python.pkgs.gunicorn} "''${!outputBin}"/bin/machine-learning \
69 --prefix PYTHONPATH : "$out/${python.sitePackages}:${python.pkgs.makePythonPath dependencies}" \
70 --set-default MACHINE_LEARNING_WORKERS 1 \
71 --set-default MACHINE_LEARNING_WORKER_TIMEOUT 120 \
72 --set-default MACHINE_LEARNING_CACHE_FOLDER /var/cache/immich \
73 --set-default IMMICH_HOST "[::]" \
74 --set-default IMMICH_PORT 3003 \
75 --add-flags "app.main:app -k app.config.CustomUvicornWorker \
76 -w \"\$MACHINE_LEARNING_WORKERS\" \
77 -b \"\$IMMICH_HOST:\$IMMICH_PORT\" \
78 -t \"\$MACHINE_LEARNING_WORKER_TIMEOUT\"
79 --log-config-json $out/share/immich/log_conf.json"
83 inherit (nixosTests) immich;
87 description = "${immich.meta.description} (machine learning component)";
88 homepage = "https://github.com/immich-app/immich/tree/main/machine-learning";
89 mainProgram = "machine-learning";
90 inherit (immich.meta) license maintainers platforms;