nixos/immich: fix postgresql.package regression

`config.services.postgresql.package` is now only available when the
PostgreSQL module is actually enabled. If we're not using the local
database, we'll need to fallback to the latest postgresql version, since
we don't know about the remote version.
This commit is contained in:
Wolfgang Walther
2025-06-20 21:40:19 +02:00
parent e780b064a8
commit 62d2b6d593

View File

@@ -46,6 +46,9 @@ let
mkOption
mkEnableOption
;
postgresqlPackage =
if cfg.database.enable then config.services.postgresql.package else pkgs.postgresql;
in
{
options.services.immich = {
@@ -265,7 +268,7 @@ in
in
[
''
${lib.getExe' config.services.postgresql.package "psql"} -d "${cfg.database.name}" -f "${sqlFile}"
${lib.getExe' postgresqlPackage "psql"} -d "${cfg.database.name}" -f "${sqlFile}"
''
];
@@ -333,7 +336,7 @@ in
path = [
# gzip and pg_dumpall are used by the backup service
pkgs.gzip
config.services.postgresql.package
postgresqlPackage
];
serviceConfig = commonServiceConfig // {