38 lines
845 B
Nix
38 lines
845 B
Nix
{ lib, config, ... }:
|
|
let
|
|
cfg = config.services.mealie;
|
|
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
|
in
|
|
{
|
|
options.services.mealie = {
|
|
subdomain = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services = {
|
|
mealie.settings = {
|
|
BASE_URL = "https://${fqdn}";
|
|
ALLOW_SIGNUP = true;
|
|
DB_ENGINE = "postgres";
|
|
POSTGRES_URL_OVERRIDE = "postgresql://mealie:@mealie?host=/var/run/postgresql";
|
|
SMTP_FROM_NAME = "Mealie";
|
|
};
|
|
|
|
webserver.vHosts.${fqdn}.locations."/".proxyPort = cfg.port;
|
|
|
|
postgresql = {
|
|
enable = lib.mkDefault true;
|
|
ensureDatabases = [ "mealie" ];
|
|
ensureUsers = [
|
|
{
|
|
name = "mealie";
|
|
ensureDBOwnership = true;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|