2020-11-23 23:07:42 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
2019-03-20 02:57:59 +01:00
|
|
|
with lib;
|
|
|
|
|
|
|
|
mkIf (elem "nextcloud" config.machine.services) {
|
2019-12-19 09:36:54 +01:00
|
|
|
services = let
|
2019-12-26 00:53:42 +01:00
|
|
|
cfg = config.machine;
|
|
|
|
domain = (findFirst (s: s.service == "nextcloud") cfg cfg.vHosts).domain;
|
2019-10-07 02:48:07 +02:00
|
|
|
in {
|
|
|
|
nextcloud = {
|
|
|
|
enable = true;
|
2023-01-29 16:22:55 +01:00
|
|
|
enableBrokenCiphersForSSE = false;
|
2019-10-07 02:48:07 +02:00
|
|
|
home = "/var/lib/nextcloud";
|
|
|
|
hostName = domain;
|
|
|
|
https = true;
|
|
|
|
maxUploadSize = "1024M";
|
2023-01-29 16:22:55 +01:00
|
|
|
package = pkgs.nextcloud25;
|
2019-10-07 02:48:07 +02:00
|
|
|
config = {
|
2019-10-09 15:13:13 +02:00
|
|
|
adminuser = mkDefault (elemAt cfg.administrators 0).name;
|
2019-10-07 02:48:07 +02:00
|
|
|
adminpassFile = "${cfg.secretPath}/nextcloud_admin";
|
|
|
|
dbtype = "mysql";
|
|
|
|
dbhost = "localhost";
|
|
|
|
dbport = "3306";
|
|
|
|
dbuser = "nextcloud";
|
|
|
|
dbpassFile = "${cfg.secretPath}/nextcloud_db";
|
|
|
|
dbname = "nextcloud";
|
|
|
|
dbtableprefix = "oc_";
|
2019-10-08 13:15:38 +02:00
|
|
|
extraTrustedDomains = cfg.extraDomains;
|
2019-10-07 02:48:07 +02:00
|
|
|
};
|
|
|
|
caching = {
|
|
|
|
apcu = true;
|
|
|
|
memcached = true;
|
|
|
|
redis = false;
|
|
|
|
};
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
2019-10-07 02:48:07 +02:00
|
|
|
# Turn Server used for nextcloud-talk
|
|
|
|
# This stuff is still untested.
|
|
|
|
coturn = mkIf (elem "nextcloud-talk" config.machine.services) {
|
|
|
|
# TLS is not needed as WebRTC is already encrypted.
|
|
|
|
enable = true;
|
|
|
|
realm = domain;
|
|
|
|
listening-port = 3478;
|
|
|
|
use-auth-secret = true;
|
|
|
|
extraConfig = ''
|
|
|
|
fingerprint
|
|
|
|
total-quota=100
|
|
|
|
bps-capacity=0
|
|
|
|
stale-nonce
|
|
|
|
no-multicast-peers
|
|
|
|
'';
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
2019-12-19 09:36:54 +01:00
|
|
|
|
|
|
|
mysql = let
|
|
|
|
cfg = config.services.nextcloud.config;
|
|
|
|
in {
|
|
|
|
ensureDatabases = [ cfg.dbname ];
|
|
|
|
ensureUsers = [{
|
|
|
|
name = cfg.dbuser;
|
|
|
|
ensurePermissions = {
|
|
|
|
"${cfg.dbname}.*" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
};
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
|
|
|
}
|