From af5c62eb4bbaac2ed0d3d22820cc47221df59072 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 15 Oct 2024 08:58:47 +0200 Subject: [PATCH] feat(services): add dedicated PostgreSQL module Introduce a dedicated PostgreSQL configuration module to the system. Adjust Nextcloud and Forgejo configurations to utilize this new module. --- systems/x86_64-linux/mx/default.nix | 17 +++++++++-------- systems/x86_64-linux/mx/forgejo.nix | 18 ------------------ systems/x86_64-linux/mx/nextcloud.nix | 13 +++++++++++++ systems/x86_64-linux/mx/postgresql.nix | 6 ++++++ 4 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 systems/x86_64-linux/mx/postgresql.nix diff --git a/systems/x86_64-linux/mx/default.nix b/systems/x86_64-linux/mx/default.nix index d0fd296..46622e2 100644 --- a/systems/x86_64-linux/mx/default.nix +++ b/systems/x86_64-linux/mx/default.nix @@ -1,19 +1,20 @@ { pkgs, lib, ... }: { imports = [ - ./hardware-configuration.nix - ./rspamd.nix # ./goaccess.nix - ./nextcloud.nix + ./acme.nix ./backup.nix - ./users.nix + ./coturn.nix + ./forgejo.nix + ./hardware-configuration.nix ./kicker.nix ./mailserver.nix - ./acme.nix - ./forgejo.nix - ./nginx.nix ./network.nix - ./coturn.nix + ./nextcloud.nix + ./nginx.nix + ./postgresql.nix + ./rspamd.nix + ./users.nix ]; metacfg = { diff --git a/systems/x86_64-linux/mx/forgejo.nix b/systems/x86_64-linux/mx/forgejo.nix index e2fd533..99bdba3 100644 --- a/systems/x86_64-linux/mx/forgejo.nix +++ b/systems/x86_64-linux/mx/forgejo.nix @@ -34,24 +34,6 @@ users.groups.gitea = { }; - services.postgresql = { - package = pkgs.postgresql_14; - ensureDatabases = [ - config.services.forgejo.database.name - "nextcloud" - ]; - ensureUsers = [ - { - name = config.services.forgejo.database.user; - ensureDBOwnership = true; - } - { - name = "nextcloud"; - ensureDBOwnership = true; - } - ]; - }; - sops.secrets."forgejo-runner-token" = { sopsFile = ../../../.secrets/hetzner/forgejo-runner-token.yaml; # bring your own password file }; diff --git a/systems/x86_64-linux/mx/nextcloud.nix b/systems/x86_64-linux/mx/nextcloud.nix index 568c308..d5c9012 100644 --- a/systems/x86_64-linux/mx/nextcloud.nix +++ b/systems/x86_64-linux/mx/nextcloud.nix @@ -5,6 +5,7 @@ environment.systemPackages = with pkgs; [ ffmpeg ]; environment.etc."nextcloud-admin-pass".text = "test123"; + services.nextcloud = { enable = true; package = pkgs.nextcloud30; @@ -44,4 +45,16 @@ "OC\\Preview\\XBitmap" ]; }; + + services.postgresql = { + ensureDatabases = [ + "nextcloud" + ]; + ensureUsers = [ + { + name = "nextcloud"; + ensureDBOwnership = true; + } + ]; + }; } diff --git a/systems/x86_64-linux/mx/postgresql.nix b/systems/x86_64-linux/mx/postgresql.nix new file mode 100644 index 0000000..8a35b8e --- /dev/null +++ b/systems/x86_64-linux/mx/postgresql.nix @@ -0,0 +1,6 @@ +{ pkgs, lib, config, ... }: +{ + services.postgresql = { + package = pkgs.postgresql_14; + }; +}