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

@ -4,25 +4,31 @@ with lib;{
let
cfg = config.elss.server.nextcloud;
in
mkIf cfg.enable {
elss.server.sql.enable = mkDefault true;
services.nextcloud = {
enable = true;
package = pkgs.nextcloud24;
hostName = "cloudstore.ellmauthaler.net";
https = true;
config = {
dbtype = "mysql";
dbuser = "cloudstore_user";
dbpassFile = config.sops.secrets.cloudstore_user.path;
adminuser = "storemin";
adminpassFile = config.sops.secrets.storemin.path;
};
};
sops.secrets = {
storemin.sopsFile = ../../secrets/server.yaml;
cloudstore_user.sopsFile = ../../secrets/server.yaml;
mkIf cfg.enable {
elss.server.sql.enable = mkDefault true;
services.nextcloud = {
enable = true;
package = pkgs.nextcloud24;
hostName = "cloudstore.ellmauthaler.net";
https = true;
config = {
dbtype = "pgsql";
dbuser = "cloudstore_user";
dbname = "nextcloud";
dbpassFile = config.sops.secrets.cloudstore_user.path;
adminuser = "storemin";
adminpassFile = config.sops.secrets.storemin.path;
dbhost = "/run/postgresql";
};
};
systemd.services."nextcloud-setup" = {
requires = [ "postgresql.service" ];
after = [ "postrgresql.service" ];
};
sops.secrets = {
storemin.sopsFile = ../../secrets/server.yaml;
cloudstore_user.sopsFile = ../../secrets/server.yaml;
};
};
}

View File

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