nixos/gitea: only require databases if createDatabase is set

Currently the database service (mysql/postgresql) is required by the
gitea service. If none of them exists on the same machine as gitea it
will refuse to start. With this change it is only required if
createDatabase was set to true.
This commit is contained in:
Christoph Hrdinka 2023-07-03 17:02:12 +02:00
parent a8a76bb718
commit 70cc0d412f
No known key found for this signature in database
GPG key ID: 39391E2F20458287

View file

@ -499,7 +499,7 @@ in
systemd.services.gitea = {
description = "gitea";
after = [ "network.target" ] ++ optional usePostgresql "postgresql.service" ++ optional useMysql "mysql.service";
requires = optional usePostgresql "postgresql.service" ++ optional useMysql "mysql.service";
requires = optional (cfg.database.createDatabase && usePostgresql) "postgresql.service" ++ optional (cfg.database.createDatabase && useMysql) "mysql.service";
wantedBy = [ "multi-user.target" ];
path = [ cfg.package pkgs.git pkgs.gnupg ];