1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Replace mariadb with psql and set it up accordingly

This commit is contained in:
Stefan Ellmauthaler 2022-06-16 23:20:20 +02:00
parent 15fcd6bdef
commit 306c0ffd69
Signed by: ellmau
GPG Key ID: C804A9C1B7AF8256
2 changed files with 32 additions and 21 deletions

View File

@ -12,14 +12,20 @@ with lib;{
hostName = "cloudstore.ellmauthaler.net"; hostName = "cloudstore.ellmauthaler.net";
https = true; https = true;
config = { config = {
dbtype = "mysql"; dbtype = "pgsql";
dbuser = "cloudstore_user"; dbuser = "cloudstore_user";
dbname = "nextcloud";
dbpassFile = config.sops.secrets.cloudstore_user.path; dbpassFile = config.sops.secrets.cloudstore_user.path;
adminuser = "storemin"; adminuser = "storemin";
adminpassFile = config.sops.secrets.storemin.path; adminpassFile = config.sops.secrets.storemin.path;
dbhost = "/run/postgresql";
}; };
}; };
systemd.services."nextcloud-setup" = {
requires = [ "postgresql.service" ];
after = [ "postrgresql.service" ];
};
sops.secrets = { sops.secrets = {
storemin.sopsFile = ../../secrets/server.yaml; storemin.sopsFile = ../../secrets/server.yaml;
cloudstore_user.sopsFile = ../../secrets/server.yaml; cloudstore_user.sopsFile = ../../secrets/server.yaml;

View File

@ -5,9 +5,14 @@ with lib;{
cfg = config.elss.server.sql; cfg = config.elss.server.sql;
in in
mkIf cfg.enable { mkIf cfg.enable {
services.mysql = { services.postgresql = {
enable = true; enable = true;
package = pkgs.mariadb; package = pkgs.postgresql_14;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [{
name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}];
}; };
}; };
} }