nixfiles/hosts/hetzner-arm/containers/postgresql/profiles/postgres.nix

42 lines
1.1 KiB
Nix
Raw Normal View History

{
self,
hostPath,
...
}: let
wireguardData = import "${self}/data/wireguard/chaosInternalWireGuard.nix";
wireguardHosts = wireguardData.hosts;
localContainersAddresses = import "${hostPath}/data/containerAddresses.nix";
in {
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [
"gotosocial"
"gotosocial_new"
"quassel"
];
ensureUsers = [
{
name = "gotosocial";
ensureDBOwnership = true;
}
{
name = "gotosocial_new";
ensureDBOwnership = true;
}
{
name = "quassel";
ensureDBOwnership = true;
}
];
# If the host is a local container then use the container's IP
# otherwise use the host's IP
authentication = ''
host gotosocial gotosocial ${localContainersAddresses.containers."social"}/32 trust
host gotosocial_new gotosocial_new ${localContainersAddresses.containers."social-02"}/32 trust
host quassel quassel ${localContainersAddresses.containers."quassel"}/32 trust
'';
};
}