services: mealie: use postgres

This commit is contained in:
Antoine Martin 2024-07-03 21:29:29 +02:00
parent 93b6c20e41
commit 0ed148eb66

View file

@ -37,9 +37,48 @@ in {
settings = { settings = {
ALLOW_SIGNUP = "false"; ALLOW_SIGNUP = "false";
BASE_URL = "https://mealie.${domain}";
TZ = config.time.timeZone;
# Use PostgreSQL
DB_ENGINE = "postgres";
# Settings for Mealie 1.2
POSTGRES_USER = "mealie";
POSTGRES_PASSWORD = "";
POSTGRES_SERVER = "/run/postgresql";
# Pydantic and/or mealie doesn't handle the URI correctly, hijack it
# with query parameters...
POSTGRES_DB = "mealie?host=/run/postgresql&dbname=mealie";
# Settings for Mealie 1.7+, when that gets into NixOS stable
# POSTGRES_URL_OVERRIDE = "postgresql://mealie:@/mealie?host=/run/postgresql";
}; };
}; };
systemd.services = {
mealie = {
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
};
};
# Set-up database
services.postgresql = {
enable = true;
ensureDatabases = [ "mealie" ];
ensureUsers = [
{
name = "mealie";
ensureDBOwnership = true;
}
];
};
services.postgresqlBackup = {
databases = ["mealie"];
};
services.nginx.virtualHosts."mealie.${domain}" = { services.nginx.virtualHosts."mealie.${domain}" = {
forceSSL = true; forceSSL = true;
useACMEHost = fqdn; useACMEHost = fqdn;