2023-10-29 13:12:10 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
flake,
|
|
|
|
...
|
2023-11-05 22:47:06 +00:00
|
|
|
}:
|
|
|
|
{
|
2023-10-28 16:53:02 +00:00
|
|
|
age.secrets."nextcloud-secrets" = {
|
|
|
|
file = "${flake.self}/secrets/nextcloud-secrets.age";
|
|
|
|
mode = "400";
|
2023-10-29 13:12:10 +00:00
|
|
|
owner = "nextcloud";
|
|
|
|
};
|
|
|
|
|
|
|
|
age.secrets."nextcloud-admin-pass" = {
|
|
|
|
file = "${flake.self}/secrets/nextcloud-admin-pass.age";
|
|
|
|
mode = "400";
|
|
|
|
owner = "nextcloud";
|
2023-10-28 16:53:02 +00:00
|
|
|
};
|
|
|
|
|
2024-05-08 17:47:47 +00:00
|
|
|
services.nginx.virtualHosts."cloud.${config.pub-solar-os.networking.domain}" = {
|
2023-10-28 19:34:47 +00:00
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
};
|
|
|
|
|
2023-10-28 14:53:40 +00:00
|
|
|
services.nextcloud = {
|
2024-05-08 17:47:47 +00:00
|
|
|
hostName = "cloud.${config.pub-solar-os.networking.domain}";
|
2023-10-28 14:53:40 +00:00
|
|
|
home = "/var/lib/nextcloud";
|
|
|
|
|
|
|
|
enable = true;
|
2024-05-31 15:45:21 +00:00
|
|
|
package = pkgs.nextcloud29;
|
2023-10-28 14:53:40 +00:00
|
|
|
https = true;
|
2023-10-28 16:53:02 +00:00
|
|
|
secretFile = config.age.secrets."nextcloud-secrets".path; # secret
|
2023-10-29 13:12:10 +00:00
|
|
|
maxUploadSize = "1G";
|
2023-10-28 14:53:40 +00:00
|
|
|
|
|
|
|
configureRedis = true;
|
|
|
|
|
|
|
|
notify_push = {
|
|
|
|
enable = true;
|
2023-11-18 16:38:58 +00:00
|
|
|
bendDomainToLocalhost = true;
|
2023-10-28 14:53:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
adminuser = "admin";
|
2023-10-29 13:12:10 +00:00
|
|
|
adminpassFile = config.age.secrets."nextcloud-admin-pass".path;
|
2023-10-28 14:53:40 +00:00
|
|
|
dbuser = "nextcloud";
|
|
|
|
dbtype = "pgsql";
|
|
|
|
dbname = "nextcloud";
|
|
|
|
dbtableprefix = "oc_";
|
|
|
|
};
|
|
|
|
|
2024-06-12 11:07:11 +00:00
|
|
|
settings = {
|
2024-05-08 17:47:47 +00:00
|
|
|
overwrite.cli.url = "http://cloud.${config.pub-solar-os.networking.domain}";
|
2024-06-12 11:07:11 +00:00
|
|
|
overwriteprotocol = "https";
|
2023-10-28 14:53:40 +00:00
|
|
|
|
|
|
|
installed = true;
|
|
|
|
default_phone_region = "+49";
|
|
|
|
mail_sendmailmode = "smtp";
|
|
|
|
mail_from_address = "nextcloud";
|
|
|
|
mail_smtpmode = "smtp";
|
|
|
|
mail_smtpauthtype = "PLAIN";
|
|
|
|
mail_domain = "pub.solar";
|
|
|
|
mail_smtpname = "admins@pub.solar";
|
2024-06-08 21:54:05 +00:00
|
|
|
mail_smtpsecure = "ssl";
|
|
|
|
mail_smtpauth = true;
|
2024-05-27 15:51:32 +00:00
|
|
|
mail_smtphost = "mail.pub.solar";
|
2024-06-08 21:54:05 +00:00
|
|
|
mail_smtpport = "465";
|
2023-10-28 14:53:40 +00:00
|
|
|
|
2023-10-29 18:17:53 +00:00
|
|
|
# This is to allow connections to collabora and keycloak, among other services
|
|
|
|
# running on the same host
|
2023-10-31 20:24:27 +00:00
|
|
|
#
|
2023-10-29 18:17:53 +00:00
|
|
|
# https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=allow_local_remote_servers%20true
|
|
|
|
# https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/293
|
|
|
|
allow_local_remote_servers = true;
|
|
|
|
|
2023-10-28 14:53:40 +00:00
|
|
|
enable_previews = true;
|
|
|
|
enabledPreviewProviders = [
|
|
|
|
"OC\\Preview\\PNG"
|
|
|
|
"OC\\Preview\\JPEG"
|
|
|
|
"OC\\Preview\\GIF"
|
|
|
|
"OC\\Preview\\BMP"
|
|
|
|
"OC\\Preview\\XBitmap"
|
|
|
|
"OC\\Preview\\Movie"
|
|
|
|
"OC\\Preview\\PDF"
|
|
|
|
"OC\\Preview\\MP3"
|
|
|
|
"OC\\Preview\\TXT"
|
|
|
|
"OC\\Preview\\MarkDown"
|
|
|
|
];
|
|
|
|
preview_max_x = "1024";
|
|
|
|
preview_max_y = "768";
|
|
|
|
preview_max_scale_factor = "1";
|
|
|
|
|
|
|
|
auth.bruteforce.protection.enabled = true;
|
|
|
|
trashbin_retention_obligation = "auto,7";
|
2024-06-12 11:07:11 +00:00
|
|
|
skeletondirectory = "./nextcloud-skeleton";
|
2023-10-28 14:53:40 +00:00
|
|
|
defaultapp = "file";
|
|
|
|
activity_expire_days = "14";
|
|
|
|
integrity.check.disabled = false;
|
|
|
|
updater.release.channel = "stable";
|
2024-06-23 13:01:37 +00:00
|
|
|
loglevel = 2;
|
|
|
|
debug = false;
|
2024-04-05 14:23:16 +00:00
|
|
|
maintenance_window_start = "1";
|
2023-10-29 12:52:11 +00:00
|
|
|
# maintenance = false;
|
2023-10-28 14:53:40 +00:00
|
|
|
app_install_overwrite = [
|
|
|
|
"pdfdraw"
|
|
|
|
"integration_whiteboard"
|
|
|
|
];
|
|
|
|
htaccess.RewriteBase = "/";
|
|
|
|
theme = "";
|
|
|
|
simpleSignUpLink.shown = false;
|
|
|
|
};
|
|
|
|
|
2024-01-23 21:18:58 +00:00
|
|
|
phpOptions = {
|
2024-02-01 10:21:10 +00:00
|
|
|
"opcache.interned_strings_buffer" = "32";
|
2024-06-23 13:01:37 +00:00
|
|
|
"opcache.max_accelerated_files" = "16229";
|
|
|
|
"opcache.memory_consumption" = "256";
|
|
|
|
# https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#enable-php-opcache
|
|
|
|
"opcache.revalidate_freq" = "60";
|
2024-01-25 18:06:24 +00:00
|
|
|
# https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#:~:text=opcache.jit%20%3D%201255%20opcache.jit_buffer_size%20%3D%20128m
|
|
|
|
"opcache.jit" = "1255";
|
|
|
|
"opcache.jit_buffer_size" = "128M";
|
2024-01-23 21:18:58 +00:00
|
|
|
};
|
|
|
|
|
2023-10-31 20:24:27 +00:00
|
|
|
# Calculated with 4GiB RAM, 80MiB process size available on
|
|
|
|
# https://spot13.com/pmcalculator/
|
|
|
|
poolSettings = {
|
|
|
|
pm = "dynamic";
|
|
|
|
"pm.max_children" = "52";
|
|
|
|
"pm.max_requests" = "500";
|
|
|
|
"pm.max_spare_servers" = "39";
|
|
|
|
"pm.min_spare_servers" = "13";
|
|
|
|
"pm.start_servers" = "13";
|
|
|
|
};
|
|
|
|
|
2023-10-28 14:53:40 +00:00
|
|
|
caching.redis = true;
|
|
|
|
autoUpdateApps.enable = true;
|
|
|
|
database.createLocally = true;
|
|
|
|
};
|
2023-11-05 21:54:09 +00:00
|
|
|
|
2023-11-18 21:28:12 +00:00
|
|
|
services.restic.backups.nextcloud-storagebox = {
|
|
|
|
paths = [
|
|
|
|
"/var/lib/nextcloud/data"
|
|
|
|
"/tmp/nextcloud-backup.sql"
|
|
|
|
];
|
|
|
|
timerConfig = {
|
2024-05-15 19:00:41 +00:00
|
|
|
OnCalendar = "*-*-* 01:00:00 Etc/UTC";
|
2023-11-18 21:28:12 +00:00
|
|
|
};
|
|
|
|
initialize = true;
|
2024-08-29 14:22:58 +00:00
|
|
|
passwordFile = config.age.secrets."restic-repo-storagebox-nachtigall".path;
|
2023-11-18 21:28:12 +00:00
|
|
|
repository = "sftp:u377325@u377325.your-storagebox.de:/backups";
|
|
|
|
backupPrepareCommand = ''
|
|
|
|
${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dump -d nextcloud > /tmp/nextcloud-backup.sql
|
|
|
|
'';
|
|
|
|
backupCleanupCommand = ''
|
|
|
|
rm /tmp/nextcloud-backup.sql
|
|
|
|
'';
|
2024-04-22 18:06:49 +00:00
|
|
|
pruneOpts = [
|
|
|
|
"--keep-daily 7"
|
|
|
|
"--keep-weekly 4"
|
|
|
|
"--keep-monthly 3"
|
|
|
|
];
|
2023-11-18 21:28:12 +00:00
|
|
|
};
|
2023-10-28 14:53:40 +00:00
|
|
|
}
|