diff --git a/nixos/modules/services/finance/libeufin/common.nix b/nixos/modules/services/finance/libeufin/common.nix index 4e0a6bffe02f..20b99ce9c396 100644 --- a/nixos/modules/services/finance/libeufin/common.nix +++ b/nixos/modules/services/finance/libeufin/common.nix @@ -96,7 +96,9 @@ libeufinComponent: }; in { - path = [ config.services.postgresql.package ]; + path = [ + (if cfg.createLocalDatabase then config.services.postgresql.package else pkgs.postgresql) + ]; serviceConfig = { Type = "oneshot"; DynamicUser = true; diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix index 7cb723e3172c..c31c4b069928 100644 --- a/nixos/modules/services/mail/roundcube.nix +++ b/nixos/modules/services/mail/roundcube.nix @@ -272,7 +272,7 @@ in ]; systemd.services.roundcube-setup = lib.mkMerge [ - (lib.mkIf (cfg.database.host == "localhost") { + (lib.mkIf localDB { requires = [ "postgresql.service" ]; after = [ "postgresql.service" ]; }) @@ -281,7 +281,9 @@ in after = [ "network-online.target" ]; wantedBy = [ "multi-user.target" ]; - path = [ config.services.postgresql.package ]; + path = [ + (if localDB then config.services.postgresql.package else pkgs.postgresql) + ]; script = let psql = "${lib.optionalString (!localDB) "PGPASSFILE=${cfg.database.passwordFile}"} psql ${ diff --git a/nixos/modules/services/web-apps/immich.nix b/nixos/modules/services/web-apps/immich.nix index a647b552678f..28e89709afde 100644 --- a/nixos/modules/services/web-apps/immich.nix +++ b/nixos/modules/services/web-apps/immich.nix @@ -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 // {