nixos/roundcube: only configure postgres config if localhost is used as database
When using a different database, the evaluation fails as `config.services.postgresql.package` is only set if `services.postgresql` is enabled. Also, the systemd service shouldn't have a relation to postgres if a remote database is used.
This commit is contained in:
parent
92e5745383
commit
6b6348eaba
|
@ -141,11 +141,14 @@ in
|
|||
|
||||
systemd.services.roundcube-setup = let
|
||||
pgSuperUser = config.services.postgresql.superUser;
|
||||
in {
|
||||
in mkMerge [
|
||||
(mkIf (cfg.database.host == "localhost") {
|
||||
requires = [ "postgresql.service" ];
|
||||
after = [ "postgresql.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = [ config.services.postgresql.package ];
|
||||
})
|
||||
{
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
mkdir -p /var/lib/roundcube
|
||||
if [ ! -f /var/lib/roundcube/db-created ]; then
|
||||
|
@ -162,6 +165,7 @@ in
|
|||
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue