initial setup
This commit is contained in:
commit
b27835f9b7
26 changed files with 964 additions and 0 deletions
71
fili/services/databases.nix
Normal file
71
fili/services/databases.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
services.postgresql = rec {
|
||||
package = pkgs.postgresql_15;
|
||||
enable = true;
|
||||
enableTCPIP = true;
|
||||
authentication = pkgs.lib.mkOverride 10 ''
|
||||
# allow local logins
|
||||
local all all trust
|
||||
|
||||
# loopback (v4/v6)
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
|
||||
# and from podman
|
||||
host all all 10.88.0.0/16 trust
|
||||
|
||||
# and from vms
|
||||
host all all 10.0.0.0/24 trust
|
||||
|
||||
# and the local network
|
||||
host all all 192.168.0.0/24 trust
|
||||
'';
|
||||
settings = {
|
||||
listen_addresses = "*";
|
||||
};
|
||||
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "matrix";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "recipes";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "sleep";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "houses";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "dnote";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
ensureDatabases = map (i: i.name) ensureUsers;
|
||||
};
|
||||
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
settings = {
|
||||
mysqld = {
|
||||
bind-address = "0.0.0.0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall.allowedTCPPorts = [
|
||||
# postgres
|
||||
5432
|
||||
# mariadb
|
||||
3306
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue