2024-05-11 22:55:59 +02:00
|
|
|
{ pkgs, config, ... }:
|
2024-05-08 21:49:37 +02:00
|
|
|
let
|
2024-05-09 14:55:02 +02:00
|
|
|
inherit (config.serverConfig) ports vhosts;
|
2024-05-08 21:50:08 +02:00
|
|
|
in
|
|
|
|
{
|
2024-05-08 21:49:37 +02:00
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [ "nextcloud" ];
|
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "nextcloud";
|
|
|
|
ensureDBOwnership = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
age.secrets = {
|
|
|
|
nextcloud_admin_pass = {
|
|
|
|
file = ../secrets/nextcloud_admin_pass.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0600";
|
|
|
|
};
|
2024-05-30 22:12:15 +02:00
|
|
|
nextcloud_server_key = {
|
2024-05-25 23:15:59 +02:00
|
|
|
file = ../secrets/nextcloud_server_key.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0600";
|
|
|
|
};
|
2024-05-08 21:49:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services.redis.servers.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
bind = "::1";
|
2024-05-09 14:55:02 +02:00
|
|
|
port = ports.redis_nextcloud_port.port;
|
2024-05-08 21:49:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.nextcloud-setup.serviceConfig.ExecStartPost = pkgs.writeScript "nextcloud-redis.sh" ''
|
|
|
|
#!${pkgs.runtimeShell}
|
|
|
|
nextcloud-occ config:system:set redis 'host' --value '::1' --type string
|
2024-05-09 14:55:02 +02:00
|
|
|
nextcloud-occ config:system:set redis '${builtins.toString config.services.redis.servers.nextcloud.port}' --value 6379 --type integer
|
2024-05-08 21:49:37 +02:00
|
|
|
nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string
|
|
|
|
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
2024-05-08 21:50:08 +02:00
|
|
|
'';
|
2024-05-08 21:49:37 +02:00
|
|
|
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
https = true;
|
2024-05-09 14:55:02 +02:00
|
|
|
hostName = vhosts.nextcloud_host.host;
|
2024-05-09 14:57:35 +02:00
|
|
|
package = pkgs.nextcloud29;
|
2024-05-08 21:49:37 +02:00
|
|
|
caching.redis = true;
|
|
|
|
|
2024-05-09 14:55:02 +02:00
|
|
|
extraApps = {
|
2024-05-29 09:54:13 +02:00
|
|
|
inherit (config.services.nextcloud.package.packages.apps) calendar tasks;
|
2024-05-09 14:55:02 +02:00
|
|
|
};
|
|
|
|
|
2024-05-08 21:49:37 +02:00
|
|
|
config = {
|
|
|
|
adminpassFile = config.age.secrets.nextcloud_admin_pass.path;
|
|
|
|
dbuser = "nextcloud";
|
2024-05-08 21:50:08 +02:00
|
|
|
dbhost = "localhost:${builtins.toString config.services.postgresql.settings.port}";
|
2024-05-08 21:49:37 +02:00
|
|
|
dbtype = "pgsql";
|
|
|
|
};
|
|
|
|
settings = {
|
|
|
|
overwriteProtocol = "https";
|
|
|
|
defaultPhoneRegion = "DE";
|
|
|
|
filelocking.enabled = true;
|
2024-05-25 23:15:59 +02:00
|
|
|
sseCKeyFile = config.age.secrets.nextcloud_server_key;
|
2024-05-08 21:49:37 +02:00
|
|
|
redis = {
|
|
|
|
host = "localhost";
|
2024-05-09 14:55:02 +02:00
|
|
|
port = config.services.redis.servers.nextcloud.port;
|
2024-05-08 21:49:37 +02:00
|
|
|
timeout = 0.0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
phpOptions = {
|
|
|
|
"opcache.interned_strings_buffer" = "12";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|