0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

immich: some improvements (#344237)

This commit is contained in:
Robert Schütz 2024-09-26 07:14:52 -07:00 committed by GitHub
commit c5d95d4999
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 30 deletions

View file

@ -290,7 +290,7 @@ in
wantedBy = [ "multi-user.target" ];
inherit (cfg.machine-learning) environment;
serviceConfig = commonServiceConfig // {
ExecStart = lib.getExe cfg.package.machine-learning;
ExecStart = lib.getExe (cfg.package.machine-learning.override { immich = cfg.package; });
CacheDirectory = "immich";
User = cfg.user;
Group = cfg.group;

View file

@ -1,46 +1,43 @@
{
lib,
src,
fetchFromGitHub,
immich,
python3,
# Override Python packages using
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
# Applied after defaultOverrides
packageOverrides ? self: super: { },
}:
let
defaultOverrides = self: super: {
pydantic = super.pydantic_1;
versioningit = super.versioningit.overridePythonAttrs (_: {
doCheck = false;
});
albumentations = super.albumentations.overridePythonAttrs (_: rec {
version = "1.4.3";
src = fetchFromGitHub {
owner = "albumentations-team";
repo = "albumentations";
rev = version;
hash = "sha256-JIBwjYaUP4Sc1bVM/zlj45cz9OWpb/LOBsIqk1m+sQA=";
};
});
};
python = python3.override {
self = python;
packageOverrides = lib.composeExtensions defaultOverrides packageOverrides;
packageOverrides = self: super: {
pydantic = super.pydantic_1;
versioningit = super.versioningit.overridePythonAttrs (_: {
doCheck = false;
});
albumentations = super.albumentations.overridePythonAttrs (_: rec {
version = "1.4.3";
src = fetchFromGitHub {
owner = "albumentations-team";
repo = "albumentations";
rev = version;
hash = "sha256-JIBwjYaUP4Sc1bVM/zlj45cz9OWpb/LOBsIqk1m+sQA=";
};
});
};
};
in
python.pkgs.buildPythonApplication {
pname = "immich-machine-learning";
inherit (immich) version;
src = "${src}/machine-learning";
src = "${immich.src}/machine-learning";
pyproject = true;
postPatch = ''
substituteInPlace pyproject.toml --replace-fail 'fastapi-slim' 'fastapi'
# AttributeError: module 'cv2' has no attribute 'Mat'
substituteInPlace app/test_main.py --replace-fail ": cv2.Mat" ""
'';
pythonRelaxDeps = [ "setuptools" ];
@ -72,7 +69,12 @@ python.pkgs.buildPythonApplication {
]
++ uvicorn.optional-dependencies.standard;
doCheck = false;
nativeCheckInputs = with python.pkgs; [
httpx
pytest-asyncio
pytest-mock
pytestCheckHook
];
postInstall = ''
mkdir -p $out/share/immich

View file

@ -8,7 +8,7 @@
node-gyp,
runCommand,
nixosTests,
callPackage,
immich-machine-learning,
# build-time deps
glib,
pkg-config,
@ -210,7 +210,7 @@ buildNpmPackage' {
inherit (nixosTests) immich;
};
machine-learning = callPackage ./machine-learning.nix { inherit src; };
machine-learning = immich-machine-learning;
inherit
src

View file

@ -41,4 +41,4 @@ for npm_component in cli server web "open-api/typescript-sdk"; do
done
rm "$lock"
cp "$sources_tmp" sources.json
mv "$sources_tmp" sources.json