grimm-nix-server/modules/nextcloud.nix

82 lines
2.1 KiB
Nix
Raw Normal View History

2023-12-30 13:48:12 +01:00
{ pkgs, config, ...} :
let
root_host = "grimmauld.de";
nextcloud_host = "cloud.${root_host}";
nextcloud_port = 8083;
in {
services.postgresql = {
enable = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{
name = "nextcloud";
ensureDBOwnership = true;
}
];
};
2023-12-30 13:48:12 +01:00
security.acme.certs."${root_host}".extraDomainNames = [ nextcloud_host ];
age.secrets = {
nextcloud_admin_pass = {
file = ../secrets/nextcloud_admin_pass.age;
owner = "nextcloud";
group = "nextcloud";
mode = "0600";
};
};
services.redis.servers.nextcloud = {
enable = true;
bind = "::1";
port = 6379;
2023-12-30 13:48:12 +01: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
nextcloud-occ config:system:set redis 'port' --value 6379 --type integer
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
'';
2023-12-30 13:48:12 +01:00
services.nextcloud = {
enable = true;
https = true;
hostName = nextcloud_host;
package = pkgs.nextcloud28;
caching.redis = true;
2023-12-30 13:48:12 +01:00
# extraApps = with config.services.nextcloud.package.packages.apps; [
# news contacts calendar tasks;
# ];
config = {
overwriteProtocol = "https";
2023-12-30 13:48:12 +01:00
adminpassFile = config.age.secrets.nextcloud_admin_pass.path;
dbport = config.services.postgresql.port;
dbuser = "nextcloud";
dbtype = "pgsql";
defaultPhoneRegion = "DE";
};
phpOptions = {
"opcache.interned_strings_buffer" = "12";
};
extraOptions = {
filelocking.enabled = true;
redis = {
host = "localhost";
port = 6379;
timeout = 0.0;
};
2023-12-30 13:48:12 +01:00
};
};
services.nginx = {
enable = true;
virtualHosts."${nextcloud_host}" = {
serverName = nextcloud_host;
forceSSL = true;
useACMEHost = root_host;
};
};
}