|
1 | 1 | { |
2 | 2 | lib, |
3 | | - src, |
4 | 3 | fetchFromGitHub, |
5 | 4 | immich, |
6 | 5 | python3, |
7 | | - # Override Python packages using |
8 | | - # self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); } |
9 | | - # Applied after defaultOverrides |
10 | | - packageOverrides ? self: super: { }, |
11 | 6 | }: |
12 | 7 | let |
13 | | - defaultOverrides = self: super: { |
14 | | - pydantic = super.pydantic_1; |
| 8 | + python = python3.override { |
| 9 | + self = python; |
15 | 10 |
|
16 | | - versioningit = super.versioningit.overridePythonAttrs (_: { |
17 | | - doCheck = false; |
18 | | - }); |
| 11 | + packageOverrides = self: super: { |
| 12 | + pydantic = super.pydantic_1; |
19 | 13 |
|
20 | | - albumentations = super.albumentations.overridePythonAttrs (_: rec { |
21 | | - version = "1.4.3"; |
22 | | - src = fetchFromGitHub { |
23 | | - owner = "albumentations-team"; |
24 | | - repo = "albumentations"; |
25 | | - rev = version; |
26 | | - hash = "sha256-JIBwjYaUP4Sc1bVM/zlj45cz9OWpb/LOBsIqk1m+sQA="; |
27 | | - }; |
28 | | - }); |
29 | | - }; |
| 14 | + versioningit = super.versioningit.overridePythonAttrs (_: { |
| 15 | + doCheck = false; |
| 16 | + }); |
30 | 17 |
|
31 | | - python = python3.override { |
32 | | - self = python; |
33 | | - packageOverrides = lib.composeExtensions defaultOverrides packageOverrides; |
| 18 | + albumentations = super.albumentations.overridePythonAttrs (_: rec { |
| 19 | + version = "1.4.3"; |
| 20 | + src = fetchFromGitHub { |
| 21 | + owner = "albumentations-team"; |
| 22 | + repo = "albumentations"; |
| 23 | + rev = version; |
| 24 | + hash = "sha256-JIBwjYaUP4Sc1bVM/zlj45cz9OWpb/LOBsIqk1m+sQA="; |
| 25 | + }; |
| 26 | + }); |
| 27 | + }; |
34 | 28 | }; |
35 | 29 | in |
36 | 30 | python.pkgs.buildPythonApplication { |
37 | 31 | pname = "immich-machine-learning"; |
38 | 32 | inherit (immich) version; |
39 | | - src = "${src}/machine-learning"; |
| 33 | + src = "${immich.src}/machine-learning"; |
40 | 34 | pyproject = true; |
41 | 35 |
|
42 | 36 | postPatch = '' |
43 | 37 | substituteInPlace pyproject.toml --replace-fail 'fastapi-slim' 'fastapi' |
| 38 | +
|
| 39 | + # AttributeError: module 'cv2' has no attribute 'Mat' |
| 40 | + substituteInPlace app/test_main.py --replace-fail ": cv2.Mat" "" |
44 | 41 | ''; |
45 | 42 |
|
46 | 43 | pythonRelaxDeps = [ "setuptools" ]; |
@@ -72,7 +69,12 @@ python.pkgs.buildPythonApplication { |
72 | 69 | ] |
73 | 70 | ++ uvicorn.optional-dependencies.standard; |
74 | 71 |
|
75 | | - doCheck = false; |
| 72 | + nativeCheckInputs = with python.pkgs; [ |
| 73 | + httpx |
| 74 | + pytest-asyncio |
| 75 | + pytest-mock |
| 76 | + pytestCheckHook |
| 77 | + ]; |
76 | 78 |
|
77 | 79 | postInstall = '' |
78 | 80 | mkdir -p $out/share/immich |
|
0 commit comments