Add postgresql module
This commit is contained in:
parent
162e7bc114
commit
31c747812e
@ -43,7 +43,8 @@
|
||||
|
||||
services.openssh.settings.PermitRootLogin = lib.mkForce "prohibit-password";
|
||||
|
||||
modules = {
|
||||
modules = rec {
|
||||
databases.postgresql.enable = true;
|
||||
services = {
|
||||
borgmatic = {
|
||||
enable = true;
|
||||
@ -61,7 +62,10 @@
|
||||
};
|
||||
gitea.enable = true;
|
||||
headscale.enable = true;
|
||||
matrix-synapse.enable = true;
|
||||
matrix-synapse = {
|
||||
enable = true;
|
||||
usePostgresql = databases.postgresql.enable;
|
||||
};
|
||||
nginx.enable = true;
|
||||
photoprism.enable = true;
|
||||
};
|
||||
|
38
modules/databases/postgresql.nix
Normal file
38
modules/databases/postgresql.nix
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.modules.databases.postgresql;
|
||||
in {
|
||||
options.modules.databases.postgresql = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
initdbArgs = [
|
||||
"--allow-group-access"
|
||||
];
|
||||
settings = {
|
||||
log_connections = true;
|
||||
log_disconnections = true;
|
||||
log_destination = lib.mkForce "syslog";
|
||||
};
|
||||
};
|
||||
|
||||
services.borgmatic.settings = {
|
||||
postgresql_databases = [
|
||||
{
|
||||
name = "all";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
imports = [
|
||||
./options.nix
|
||||
./podman.nix
|
||||
./databases/postgresql.nix
|
||||
./desktop/gnome.nix
|
||||
./desktop/forensics.nix
|
||||
./desktop/hyprland.nix
|
||||
|
@ -22,7 +22,7 @@ in {
|
||||
default = "vimium.com";
|
||||
example = "vimium.com";
|
||||
};
|
||||
usePostgres = lib.mkOption {
|
||||
usePostgresql = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
@ -129,7 +129,7 @@ in {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings = {
|
||||
database.name = (if cfg.usePostgres then "psycopg2" else "sqlite3");
|
||||
database.name = (if cfg.usePostgresql then "psycopg2" else "sqlite3");
|
||||
enable_metrics = false;
|
||||
enable_registration = false;
|
||||
max_upload_size = "100M";
|
||||
@ -138,7 +138,7 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = lib.mkIf cfg.usePostgres {
|
||||
services.postgresql = lib.mkIf cfg.usePostgresql {
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "matrix-synapse";
|
||||
|
Loading…
x
Reference in New Issue
Block a user