From ce14f19125dfa67a85b3987b6ad79c1da8ee221d Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Tue, 31 Dec 2024 22:44:37 +0400 Subject: [PATCH] make postgres module --- modules/server/postgresql.nix | 30 +++++++++++++++++++++++++++++ modules/server/services/forgejo.nix | 4 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 modules/server/postgresql.nix diff --git a/modules/server/postgresql.nix b/modules/server/postgresql.nix new file mode 100644 index 00000000..7ee5ba1f --- /dev/null +++ b/modules/server/postgresql.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: +with lib; +let cfg = config.void.server.postgresql; +in { + options.void.server.postgresql = { enable = mkEnableOption false; }; + + config = mkIf cfg.enable { + services.postgresql = { + enable = true; + ensureDatabases = [ "forgejo" ]; + ensureUsers = [ + { + name = "postgres"; + ensureClauses = { + superuser = true; + login = true; + createrole = true; + createdb = true; + replication = true; + }; + } + { + name = "forgejo"; + ensureDBOwnereship = true; + } + ]; + }; + }; +} + diff --git a/modules/server/services/forgejo.nix b/modules/server/services/forgejo.nix index 6e59904b..c7830a22 100644 --- a/modules/server/services/forgejo.nix +++ b/modules/server/services/forgejo.nix @@ -7,7 +7,9 @@ in { config = mkIf cfg.enable { services.forgejo = { enable = true; - # settings = { }; + # settings = { + + # }; }; }; }