Merge pull request #278152 from ckiee/roundcube-fix-postgresql-package-ref

nixos/roundcube: eliminate extra postgres package for local databases
This commit is contained in:
Maximilian Bosch 2024-04-24 21:33:54 +00:00 committed by GitHub
commit e59f7ab9ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,14 +247,15 @@ in
(mkIf (cfg.database.host == "localhost") {
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
path = [ config.services.postgresql.package ];
})
{
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = [ config.services.postgresql.package ];
script = let
psql = "${lib.optionalString (!localDB) "PGPASSFILE=${cfg.database.passwordFile}"} ${pkgs.postgresql}/bin/psql ${lib.optionalString (!localDB) "-h ${cfg.database.host} -U ${cfg.database.username} "} ${cfg.database.dbname}";
psql = "${lib.optionalString (!localDB) "PGPASSFILE=${cfg.database.passwordFile}"} psql ${lib.optionalString (!localDB) "-h ${cfg.database.host} -U ${cfg.database.username} "} ${cfg.database.dbname}";
in
''
version="$(${psql} -t <<< "select value from system where name = 'roundcube-version';" || true)"