Update nextcloud service and configure for sops.

This commit is contained in:
Kevin Baensch 2023-09-10 15:29:51 +02:00
parent 08c9606679
commit c2aa9993ec
Signed by: derped
GPG key ID: C0F1D326C7626543

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, fn, ... }:
with lib; with lib;
@ -14,15 +14,15 @@ mkIf (elem "nextcloud" config.machine.services) {
hostName = domain; hostName = domain;
https = true; https = true;
maxUploadSize = "1024M"; maxUploadSize = "1024M";
package = pkgs.nextcloud25; package = pkgs.nextcloud27;
config = { config = {
adminuser = mkDefault (elemAt cfg.administrators 0).name; adminuser = mkDefault (elemAt cfg.administrators 0).name;
adminpassFile = "${cfg.secretPath}/nextcloud_admin"; adminpassFile = config.sops.secrets."services/nextcloud/adminPass".path;
dbtype = "mysql"; dbtype = "mysql";
dbhost = "localhost"; dbhost = "localhost";
dbport = "3306"; dbport = "3306";
dbuser = "nextcloud"; dbuser = "nextcloud";
dbpassFile = "${cfg.secretPath}/nextcloud_db"; dbpassFile = config.sops.secrets."services/nextcloud/dbPass".path;
dbname = "nextcloud"; dbname = "nextcloud";
dbtableprefix = "oc_"; dbtableprefix = "oc_";
extraTrustedDomains = cfg.extraDomains; extraTrustedDomains = cfg.extraDomains;
@ -49,17 +49,9 @@ mkIf (elem "nextcloud" config.machine.services) {
no-multicast-peers no-multicast-peers
''; '';
}; };
mysql = let
cfg = config.services.nextcloud.config;
in {
ensureDatabases = [ cfg.dbname ];
ensureUsers = [{
name = cfg.dbuser;
ensurePermissions = {
"${cfg.dbname}.*" = "ALL PRIVILEGES";
};
}];
};
}; };
sops.secrets = (fn.sopsHelper
(name: "services/nextcloud/${name}")
[ "adminPass" "dbPass" ]
{ owner = "nextcloud"; group = "nextcloud"; });
} }