Unverified Commit c5d95d49 authored by Robert Schütz's avatar Robert Schütz Committed by GitHub
Browse files

immich: some improvements (#344237)

parents 6eed6cce ce46c053
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+27 −25
Original line number Diff line number Diff line
{
  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: {
  python = python3.override {
    self = python;

    packageOverrides = self: super: {
      pydantic = super.pydantic_1;

      versioningit = super.versioningit.overridePythonAttrs (_: {
@@ -27,20 +25,19 @@ let
        };
      });
    };

  python = python3.override {
    self = python;
    packageOverrides = lib.composeExtensions defaultOverrides packageOverrides;
  };
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
+2 −2
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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