nixos/davis: fix several outstanding bugs (#409068)

This commit is contained in:
Ulrik Strid 2025-05-21 15:36:41 +02:00 committed by GitHub
commit fbbba999f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 70 additions and 23 deletions

View file

@ -220,10 +220,13 @@ in
};
nginx = lib.mkOption {
type = lib.types.submodule (
lib.recursiveUpdate (import ../web-servers/nginx/vhost-options.nix { inherit config lib; }) { }
type = lib.types.nullOr (
lib.types.submodule (
lib.recursiveUpdate (import ../web-servers/nginx/vhost-options.nix { inherit config lib; }) {
}
)
);
default = null;
default = { };
example = ''
{
serverAliases = [
@ -235,7 +238,7 @@ in
}
'';
description = ''
With this option, you can customize the nginx virtualHost settings.
Use this option to customize an nginx virtual host. To disable the nginx set this to null.
'';
};
@ -308,18 +311,16 @@ in
message = "One of services.davis.database.urlFile or services.davis.database.createLocally must be set.";
}
{
assertion = (mail.dsn != null) != (mail.dsnFile != null);
message = "One of (and only one of) services.davis.mail.dsn or services.davis.mail.dsnFile must be set.";
assertion = !(mail.dsn != null && mail.dsnFile != null);
message = "services.davis.mail.dsn and services.davis.mail.dsnFile cannot both be set.";
}
];
services.davis.config =
{
APP_ENV = "prod";
APP_CACHE_DIR = "${cfg.dataDir}/var/cache";
# note: we do not need the log dir (we log to stdout/journald), by davis/symfony will try to create it, and the default value is one in the nix-store
# so we set it to a path under dataDir to avoid something like: Unable to create the "logs" directory (/nix/store/5cfskz0ybbx37s1161gjn5klwb5si1zg-davis-4.4.1/var/log).
APP_LOG_DIR = "${cfg.dataDir}/var/log";
LOG_FILE_PATH = "/dev/stdout";
LOG_FILE_PATH = "%kernel.logs_dir%/%kernel.environment%.log";
DATABASE_DRIVER = db.driver;
INVITE_FROM_ADDRESS = mail.inviteFromAddress;
APP_SECRET._secret = cfg.appSecretFile;
@ -330,7 +331,14 @@ in
CALDAV_ENABLED = true;
CARDDAV_ENABLED = true;
}
// (if mail.dsn != null then { MAILER_DSN = mail.dsn; } else { MAILER_DSN._secret = mail.dsnFile; })
// (
if mail.dsn != null then
{ MAILER_DSN = mail.dsn; }
else if mail.dsnFile != null then
{ MAILER_DSN._secret = mail.dsnFile; }
else
{ }
)
// (
if db.createLocally then
{