Skip to content

Commit c5d95d4

Browse files
authored
immich: some improvements (#344237)
2 parents 6eed6cc + ce46c05 commit c5d95d4

File tree

4 files changed

+31
-29
lines changed

4 files changed

+31
-29
lines changed

nixos/modules/services/web-apps/immich.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ in
290290
wantedBy = [ "multi-user.target" ];
291291
inherit (cfg.machine-learning) environment;
292292
serviceConfig = commonServiceConfig // {
293-
ExecStart = lib.getExe cfg.package.machine-learning;
293+
ExecStart = lib.getExe (cfg.package.machine-learning.override { immich = cfg.package; });
294294
CacheDirectory = "immich";
295295
User = cfg.user;
296296
Group = cfg.group;

pkgs/by-name/im/immich/machine-learning.nix renamed to pkgs/by-name/im/immich-machine-learning/package.nix

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,43 @@
11
{
22
lib,
3-
src,
43
fetchFromGitHub,
54
immich,
65
python3,
7-
# Override Python packages using
8-
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
9-
# Applied after defaultOverrides
10-
packageOverrides ? self: super: { },
116
}:
127
let
13-
defaultOverrides = self: super: {
14-
pydantic = super.pydantic_1;
8+
python = python3.override {
9+
self = python;
1510

16-
versioningit = super.versioningit.overridePythonAttrs (_: {
17-
doCheck = false;
18-
});
11+
packageOverrides = self: super: {
12+
pydantic = super.pydantic_1;
1913

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+
});
3017

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+
};
3428
};
3529
in
3630
python.pkgs.buildPythonApplication {
3731
pname = "immich-machine-learning";
3832
inherit (immich) version;
39-
src = "${src}/machine-learning";
33+
src = "${immich.src}/machine-learning";
4034
pyproject = true;
4135

4236
postPatch = ''
4337
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" ""
4441
'';
4542

4643
pythonRelaxDeps = [ "setuptools" ];
@@ -72,7 +69,12 @@ python.pkgs.buildPythonApplication {
7269
]
7370
++ uvicorn.optional-dependencies.standard;
7471

75-
doCheck = false;
72+
nativeCheckInputs = with python.pkgs; [
73+
httpx
74+
pytest-asyncio
75+
pytest-mock
76+
pytestCheckHook
77+
];
7678

7779
postInstall = ''
7880
mkdir -p $out/share/immich

pkgs/by-name/im/immich/package.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
node-gyp,
99
runCommand,
1010
nixosTests,
11-
callPackage,
11+
immich-machine-learning,
1212
# build-time deps
1313
glib,
1414
pkg-config,
@@ -210,7 +210,7 @@ buildNpmPackage' {
210210
inherit (nixosTests) immich;
211211
};
212212

213-
machine-learning = callPackage ./machine-learning.nix { inherit src; };
213+
machine-learning = immich-machine-learning;
214214

215215
inherit
216216
src

pkgs/by-name/im/immich/update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ for npm_component in cli server web "open-api/typescript-sdk"; do
4141
done
4242

4343
rm "$lock"
44-
cp "$sources_tmp" sources.json
44+
mv "$sources_tmp" sources.json

0 commit comments

Comments
 (0)