grimm-nixos-laptop/modules/nextcloud.nix

77 lines
1.9 KiB
Nix
Raw Normal View History

2024-05-08 21:50:08 +02:00
{
lib,
pkgs,
config,
...
}:
2024-05-08 21:49:37 +02:00
let
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";
};
};
services.redis.servers.nextcloud = {
enable = true;
bind = "::1";
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
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;
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;
extraApps = {
inherit (config.services.nextcloud.package.packages.apps) calendar;
};
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;
redis = {
host = "localhost";
port = config.services.redis.servers.nextcloud.port;
2024-05-08 21:49:37 +02:00
timeout = 0.0;
};
};
phpOptions = {
"opcache.interned_strings_buffer" = "12";
};
};
}