From 039d3ead7ad8c4622ecf19143256de7df8bc1599 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Mon, 27 Nov 2023 15:06:57 +0100 Subject: [PATCH] Let's configure the db for gotosocial? --- nixos/queen/configuration.nix | 1 + nixos/queen/gotosocial.nix | 6 ++++++ nixos/queen/nextcloud.nix | 22 ---------------------- nixos/queen/postgres.nix | 30 ++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 nixos/queen/postgres.nix diff --git a/nixos/queen/configuration.nix b/nixos/queen/configuration.nix index ef1b84a..8a351e0 100644 --- a/nixos/queen/configuration.nix +++ b/nixos/queen/configuration.nix @@ -16,6 +16,7 @@ # You can also split up your configuration and import pieces of it here: # ./nvim.nix ./hardware-configuration.nix + ./postgres.nix ./nextcloud.nix ./mail-server.nix ./gotosocial.nix diff --git a/nixos/queen/gotosocial.nix b/nixos/queen/gotosocial.nix index 4113748..576f419 100644 --- a/nixos/queen/gotosocial.nix +++ b/nixos/queen/gotosocial.nix @@ -22,6 +22,7 @@ services.gotosocial = { enable = true; + package = pkgs.gotosocial; setupPostgresqlDB = true; settings = { application-name = "gotosocial"; @@ -41,4 +42,9 @@ smtp-from = "no-reply@social.gladtherescake.eu"; }; }; + + systemd.services."gotosocial" = { + requires = ["postgresql.service"]; + after = ["postgresql.service"]; + }; } diff --git a/nixos/queen/nextcloud.nix b/nixos/queen/nextcloud.nix index 77d399b..9e5117f 100644 --- a/nixos/queen/nextcloud.nix +++ b/nixos/queen/nextcloud.nix @@ -105,28 +105,6 @@ enable = true; }; - # Enable PostgreSQL - services.postgresql = { - enable = true; - - # Ensure the database, user, and permissions always exist - ensureDatabases = ["nextcloud" "onlyoffice" "akkoma"]; - ensureUsers = [ - { - name = "nextcloud"; - ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; - } - { - name = "onlyoffice"; - ensurePermissions."DATABASE onlyoffice" = "ALL PRIVILEGES"; - } - { - name = "akkoma"; - ensurePermissions."DATABASE akkoma" = "ALL PRIVILEGES"; - } - ]; - }; - services.aria2 = { enable = true; rpcListenPort = 6969; diff --git a/nixos/queen/postgres.nix b/nixos/queen/postgres.nix new file mode 100644 index 0000000..535e85a --- /dev/null +++ b/nixos/queen/postgres.nix @@ -0,0 +1,30 @@ +{ + config, + pkgs, + ... +}: { + services.postgresql = { + enable = true; + + # Ensure the database, user, and permissions always exist + ensureDatabases = ["nextcloud" "onlyoffice" "akkoma"]; + ensureUsers = [ + { + name = "nextcloud"; + ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; + } + { + name = "onlyoffice"; + ensurePermissions."DATABASE onlyoffice" = "ALL PRIVILEGES"; + } + { + name = "akkoma"; + ensurePermissions."DATABASE akkoma" = "ALL PRIVILEGES"; + } + { + name = "gotosocial"; + ensurePermissions."DATABASE gotosocial" = "ALL PRIVILEGES"; + } + ]; + }; +}