tfc-nixos/modules/nocodb.nix
2025-05-16 07:23:47 -05:00

55 lines
1.3 KiB
Nix

{ config, lib, pkgs, unstable, ... }:
let
dn = "table.tfcconnection.org";
in
with lib;
{
services = {
nocodb = {
enable = true;
environment = {
DB_URL="postgres:///nocodb?host=/run/postgresql";
PORT = "9989";
NC_PUBLIC_URL = "https://${dn}";
NC_SMTP_FROM = "no-reply@mail.tfcconnection.org";
NC_SMTP_HOST = "mail.tfcconnection.org";
NC_SMTP_PORT = "587";
NC_SMTP_USERNAME = "no-reply@mail.tfcconnection.org";
};
environmentFile = /nocoenv;
};
};
services.nginx.virtualHosts.${dn} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${config.services.nocodb.environment.PORT}";
proxyWebsockets = true;
};
};
services.postgresql = {
enable = true;
ensureDatabases = [ "nocodb" ];
ensureUsers = [{
name = "nocodb";
ensureDBOwnership = true;
}];
# package = with pkgs; postgresql_15;
authentication = lib.mkForce ''
#type database DBuser origin-address auth-method
# unix socket
local all all trust
# ipv4
host all all 127.0.0.1/32 trust
# ipv6
host all all ::1/128 trust
'';
settings.log_timezone = config.time.timeZone;
};
}