diff --git a/nixos/modules/services/web-apps/immich.nix b/nixos/modules/services/web-apps/immich.nix index 7dff3515a268..8ee0102a6ba4 100644 --- a/nixos/modules/services/web-apps/immich.nix +++ b/nixos/modules/services/web-apps/immich.nix @@ -446,7 +446,7 @@ in wantedBy = [ "multi-user.target" ]; inherit (cfg.machine-learning) environment; serviceConfig = commonServiceConfig // { - ExecStart = lib.getExe (cfg.package.machine-learning.override { immich = cfg.package; }); + ExecStart = lib.getExe cfg.package.machine-learning; Slice = "system-immich.slice"; CacheDirectory = "immich"; User = cfg.user; diff --git a/pkgs/by-name/im/immich/package.nix b/pkgs/by-name/im/immich/package.nix index aa698cf0a012..10b20b16b3fd 100644 --- a/pkgs/by-name/im/immich/package.nix +++ b/pkgs/by-name/im/immich/package.nix @@ -34,7 +34,6 @@ }: let pnpm = pnpm_10; - version = "2.2.3"; esbuild' = buildPackages.esbuild.override { buildGoModule = @@ -104,58 +103,29 @@ let echo "${date}" > $out/geodata-date.txt ''; - src = fetchFromGitHub { - owner = "immich-app"; - repo = "immich"; - tag = "v${version}"; - hash = "sha256-OoToTRDPXWOa7d1j1xvkZt+vKWBX4eHDiIsFs3bIlvw="; - }; - - pnpmDeps = pnpm.fetchDeps { - pname = "immich"; - inherit version src; - fetcherVersion = 2; - hash = "sha256-igkO0ID0/9uPtFAXL2v5bcFbCpZK2lcYEctWBKtFKdU="; - }; - - web = stdenv.mkDerivation { - pname = "immich-web"; - inherit version src pnpmDeps; - - nativeBuildInputs = [ - nodejs - pnpm - pnpm.configHook - ]; - - buildPhase = '' - runHook preBuild - - pnpm --filter @immich/sdk build - pnpm --filter immich-web build - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - cd web - cp -r build $out - - runHook postInstall - ''; - }; - # Without this thumbnail generation for raw photos fails with # Error: Input file has corrupt header: tiff2vips: samples_per_pixel not a whole number of bytes vips' = vips.overrideAttrs (prev: { mesonFlags = prev.mesonFlags ++ [ "-Dtiff=disabled" ]; }); in -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "immich"; - inherit version src pnpmDeps; + version = "2.2.3"; + + src = fetchFromGitHub { + owner = "immich-app"; + repo = "immich"; + tag = "v${finalAttrs.version}"; + hash = "sha256-OoToTRDPXWOa7d1j1xvkZt+vKWBX4eHDiIsFs3bIlvw="; + }; + + pnpmDeps = pnpm.fetchDeps { + pname = "immich"; + inherit (finalAttrs) version src; + fetcherVersion = 2; + hash = "sha256-igkO0ID0/9uPtFAXL2v5bcFbCpZK2lcYEctWBKtFKdU="; + }; postPatch = '' # pg_dumpall fails without database root access @@ -225,7 +195,7 @@ stdenv.mkDerivation { \) -exec rm -r {} + mkdir -p "$packageOut/build" - ln -s '${web}' "$packageOut/build/www" + ln -s '${finalAttrs.passthru.web}' "$packageOut/build/www" ln -s '${geodata}' "$packageOut/build/geodata" echo '${builtins.toJSON buildLock}' > "$packageOut/build/build-lock.json" @@ -254,18 +224,47 @@ stdenv.mkDerivation { inherit (nixosTests) immich immich-vectorchord-migration immich-vectorchord-reindex; }; - machine-learning = immich-machine-learning; + machine-learning = immich-machine-learning.override { + immich = finalAttrs.finalPackage; + }; + + web = stdenv.mkDerivation { + pname = "immich-web"; + inherit (finalAttrs) version src pnpmDeps; + + nativeBuildInputs = [ + nodejs + pnpm + pnpm.configHook + ]; + + buildPhase = '' + runHook preBuild + + pnpm --filter @immich/sdk build + pnpm --filter immich-web build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + cd web + cp -r build $out + + runHook postInstall + ''; + }; inherit - src - web geodata pnpm ; }; meta = { - changelog = "https://github.com/immich-app/immich/releases/tag/${src.tag}"; + changelog = "https://github.com/immich-app/immich/releases/tag/${finalAttrs.src.tag}"; description = "Self-hosted photo and video backup solution"; homepage = "https://immich.app/"; license = with lib.licenses; [ @@ -281,4 +280,4 @@ stdenv.mkDerivation { platforms = lib.platforms.linux ++ lib.platforms.freebsd; mainProgram = "server"; }; -} +})