mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
immich: some improvements (#344237)
This commit is contained in:
commit
c5d95d4999
4 changed files with 32 additions and 30 deletions
|
@ -290,7 +290,7 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
inherit (cfg.machine-learning) environment;
|
inherit (cfg.machine-learning) environment;
|
||||||
serviceConfig = commonServiceConfig // {
|
serviceConfig = commonServiceConfig // {
|
||||||
ExecStart = lib.getExe cfg.package.machine-learning;
|
ExecStart = lib.getExe (cfg.package.machine-learning.override { immich = cfg.package; });
|
||||||
CacheDirectory = "immich";
|
CacheDirectory = "immich";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
|
|
@ -1,46 +1,43 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
src,
|
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
immich,
|
immich,
|
||||||
python3,
|
python3,
|
||||||
# Override Python packages using
|
|
||||||
# self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); }
|
|
||||||
# Applied after defaultOverrides
|
|
||||||
packageOverrides ? self: super: { },
|
|
||||||
}:
|
}:
|
||||||
let
|
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 {
|
python = python3.override {
|
||||||
self = python;
|
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
|
in
|
||||||
python.pkgs.buildPythonApplication {
|
python.pkgs.buildPythonApplication {
|
||||||
pname = "immich-machine-learning";
|
pname = "immich-machine-learning";
|
||||||
inherit (immich) version;
|
inherit (immich) version;
|
||||||
src = "${src}/machine-learning";
|
src = "${immich.src}/machine-learning";
|
||||||
pyproject = true;
|
pyproject = true;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace pyproject.toml --replace-fail 'fastapi-slim' 'fastapi'
|
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" ];
|
pythonRelaxDeps = [ "setuptools" ];
|
||||||
|
@ -72,7 +69,12 @@ python.pkgs.buildPythonApplication {
|
||||||
]
|
]
|
||||||
++ uvicorn.optional-dependencies.standard;
|
++ uvicorn.optional-dependencies.standard;
|
||||||
|
|
||||||
doCheck = false;
|
nativeCheckInputs = with python.pkgs; [
|
||||||
|
httpx
|
||||||
|
pytest-asyncio
|
||||||
|
pytest-mock
|
||||||
|
pytestCheckHook
|
||||||
|
];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/share/immich
|
mkdir -p $out/share/immich
|
|
@ -8,7 +8,7 @@
|
||||||
node-gyp,
|
node-gyp,
|
||||||
runCommand,
|
runCommand,
|
||||||
nixosTests,
|
nixosTests,
|
||||||
callPackage,
|
immich-machine-learning,
|
||||||
# build-time deps
|
# build-time deps
|
||||||
glib,
|
glib,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
@ -210,7 +210,7 @@ buildNpmPackage' {
|
||||||
inherit (nixosTests) immich;
|
inherit (nixosTests) immich;
|
||||||
};
|
};
|
||||||
|
|
||||||
machine-learning = callPackage ./machine-learning.nix { inherit src; };
|
machine-learning = immich-machine-learning;
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
src
|
src
|
||||||
|
|
|
@ -41,4 +41,4 @@ for npm_component in cli server web "open-api/typescript-sdk"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
rm "$lock"
|
rm "$lock"
|
||||||
cp "$sources_tmp" sources.json
|
mv "$sources_tmp" sources.json
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue