Skip to content

Commit

Permalink
services: mealie: use postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
alarsyo committed Jul 3, 2024
1 parent 93b6c20 commit 0ed148e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions services/mealie.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,48 @@ in {

settings = {
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}" = {
forceSSL = true;
useACMEHost = fqdn;
Expand Down

0 comments on commit 0ed148e

Please sign in to comment.