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 let
cfg = config.elss.server.nextcloud; cfg = config.elss.server.nextcloud;
in in
mkIf cfg.enable { mkIf cfg.enable {
elss.server.sql.enable = mkDefault true; elss.server.sql.enable = mkDefault true;
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = pkgs.nextcloud24; package = pkgs.nextcloud24;
hostName = "cloudstore.ellmauthaler.net"; hostName = "cloudstore.ellmauthaler.net";
https = true; https = true;
config = { config = {
dbtype = "mysql"; dbtype = "pgsql";
dbuser = "cloudstore_user"; dbuser = "cloudstore_user";
dbpassFile = config.sops.secrets.cloudstore_user.path; dbname = "nextcloud";
adminuser = "storemin"; dbpassFile = config.sops.secrets.cloudstore_user.path;
adminpassFile = config.sops.secrets.storemin.path; adminuser = "storemin";
}; adminpassFile = config.sops.secrets.storemin.path;
}; dbhost = "/run/postgresql";
sops.secrets = {
storemin.sopsFile = ../../secrets/server.yaml;
cloudstore_user.sopsFile = ../../secrets/server.yaml;
}; };
}; };
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; 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";
}];
}; };
}; };
} }