2024-12-10 15:40:30 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
nixpkgs,
|
|
|
|
...
|
|
|
|
}:
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2023-12-08 18:50:07 +01:00
|
|
|
let
|
|
|
|
host = "cloud.dgnum.eu";
|
|
|
|
nextcloud-occ = "${config.services.nextcloud.occ}/bin/nextcloud-occ";
|
2024-10-12 19:30:36 +02:00
|
|
|
|
|
|
|
port = 9980;
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
|
|
|
{
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
services = {
|
|
|
|
nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
hostName = host;
|
|
|
|
|
|
|
|
package = pkgs.nextcloud29;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
https = true;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
config = {
|
|
|
|
dbtype = "pgsql";
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
adminpassFile = config.age.secrets."nextcloud-adminpass_file".path;
|
|
|
|
adminuser = "thubrecht";
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
objectstore.s3 = {
|
|
|
|
enable = true;
|
2023-09-11 18:56:07 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
hostname = "s3.dgnum.eu";
|
|
|
|
region = "garage";
|
|
|
|
usePathStyle = true;
|
|
|
|
port = 443;
|
2023-09-11 18:56:07 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
bucket = "nextcloud-dgnum";
|
|
|
|
key = "GKda5367c73ca607c349d83c35";
|
|
|
|
verify_bucket_exists = false;
|
|
|
|
secretFile = config.age.secrets."nextcloud-s3_secret_file".path;
|
|
|
|
};
|
2023-09-11 18:56:07 +02:00
|
|
|
};
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
maxUploadSize = "4G";
|
2023-12-05 21:54:47 +01:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
poolSettings = {
|
|
|
|
pm = "dynamic";
|
|
|
|
"pm.max_children" = 64;
|
|
|
|
"pm.max_requests" = "500";
|
|
|
|
"pm.max_spare_servers" = "8";
|
|
|
|
"pm.min_spare_servers" = "4";
|
|
|
|
"pm.start_servers" = "6";
|
|
|
|
};
|
2023-11-22 09:37:58 +01:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
phpOptions = {
|
|
|
|
short_open_tag = "Off";
|
|
|
|
expose_php = "Off";
|
|
|
|
error_reporting = "E_ALL & ~E_DEPRECATED & ~E_STRICT";
|
|
|
|
display_errors = "stderr";
|
|
|
|
"opcache.enable_cli" = "1";
|
|
|
|
"opcache.interned_strings_buffer" = "32";
|
|
|
|
"opcache.max_accelerated_files" = "10000";
|
|
|
|
"opcache.memory_consumption" = "128";
|
|
|
|
"opcache.revalidate_freq" = "1";
|
|
|
|
"opcache.fast_shutdown" = "0";
|
|
|
|
"openssl.cafile" = "/etc/ssl/certs/ca-certificates.crt";
|
|
|
|
catch_workers_output = "yes";
|
|
|
|
};
|
2023-11-22 16:01:49 +01:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
database.createLocally = true;
|
|
|
|
configureRedis = true;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
autoUpdateApps.enable = true;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
settings = {
|
|
|
|
overwriteprotocol = "https";
|
2024-07-05 18:44:49 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
overwritehost = host;
|
|
|
|
"overwrite.cli.url" = "https://${host}";
|
|
|
|
updatechecker = false;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
default_phone_region = "FR";
|
2024-07-05 18:44:49 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
trusted_proxies = [ "::1" ];
|
2024-07-05 18:44:49 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
allow_local_remote_servers = true;
|
|
|
|
maintenance_window_start = 1;
|
2023-09-11 11:17:30 +02:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
"memories.exiftool" = "${pkgs.lib.getExe pkgs.exiftool}";
|
|
|
|
"memories.vod.ffmpeg" = "${pkgs.lib.getExe pkgs.ffmpeg-headless}";
|
|
|
|
"memories.vod.ffprobe" = "${pkgs.ffmpeg-headless}/bin/ffprobe";
|
|
|
|
};
|
2023-12-08 18:50:07 +01:00
|
|
|
};
|
2023-11-22 16:07:05 +01:00
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
collabora-online = {
|
2023-12-20 13:48:11 +01:00
|
|
|
enable = true;
|
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
inherit port;
|
|
|
|
|
|
|
|
package = nixpkgs.nixos.unstable.collabora-online;
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
server_name = "code.dgnum.eu";
|
|
|
|
|
|
|
|
ssl = {
|
|
|
|
enable = false;
|
|
|
|
termination = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
remote_font_config.url = "https://cloud.dgnum.eu/apps/richdocuments/settings/fonts.json";
|
|
|
|
|
|
|
|
net.proto = "IPv4";
|
2023-12-20 13:48:11 +01:00
|
|
|
};
|
2024-12-10 15:40:30 +01:00
|
|
|
|
|
|
|
aliasGroups = [ { host = "https://cloud.dgnum.eu"; } ];
|
2023-12-20 13:48:11 +01:00
|
|
|
};
|
|
|
|
|
2024-12-10 15:40:30 +01:00
|
|
|
nginx.virtualHosts = {
|
|
|
|
${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_max_temp_file_size 4096m;
|
|
|
|
'';
|
2023-12-11 01:05:20 +01:00
|
|
|
};
|
2024-12-10 15:40:30 +01:00
|
|
|
|
|
|
|
"code.dgnum.eu" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
# static files
|
|
|
|
location ^~ /browser {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
# WOPI discovery URL
|
|
|
|
location ^~ /hosting/discovery {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Capabilities
|
|
|
|
location ^~ /hosting/capabilities {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
# main websocket
|
|
|
|
location ~ ^/cool/(.*)/ws$ {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_read_timeout 36000s;
|
|
|
|
}
|
|
|
|
|
|
|
|
# download, presentation and image upload
|
|
|
|
location ~ ^/(c|l)ool {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Admin Console websocket
|
|
|
|
location ^~ /cool/adminws {
|
|
|
|
proxy_pass http://127.0.0.1:${builtins.toString port};
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_read_timeout 36000s;
|
|
|
|
}
|
|
|
|
'';
|
2023-12-11 01:05:20 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-12-08 17:54:16 +01:00
|
|
|
|
2024-10-12 19:30:36 +02:00
|
|
|
dgn-web.internalPorts.collabora = port;
|
|
|
|
|
2023-12-08 18:50:07 +01:00
|
|
|
systemd.services = {
|
|
|
|
nextcloud-preview = {
|
|
|
|
description = "Generate preview for nextcloud media.";
|
|
|
|
script = "${nextcloud-occ} preview:pre-generate -vvv";
|
|
|
|
startAt = "*-*-* 01:00:00 UTC";
|
2024-02-02 10:51:31 +01:00
|
|
|
serviceConfig = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
2023-12-08 18:50:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nextcloud-cron.path = [ pkgs.perl ];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.ffmpeg_6-headless ];
|
2023-09-15 18:19:11 +02:00
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
networking.hosts = {
|
|
|
|
"129.199.146.148" = [ "s3.dgnum.eu" ];
|
2024-12-10 15:40:30 +01:00
|
|
|
"129.199.146.147" = [
|
|
|
|
"code.dgnum.eu"
|
|
|
|
"cloud.dgnum.eu"
|
|
|
|
];
|
2024-02-02 10:51:31 +01:00
|
|
|
};
|
2023-12-18 11:13:38 +01:00
|
|
|
|
2024-02-19 14:47:27 +01:00
|
|
|
age-secrets.autoMatch = [ "nextcloud" ];
|
2023-12-20 13:48:26 +01:00
|
|
|
|
|
|
|
system.activationScripts = {
|
|
|
|
restart-nextcloud.text = ''
|
|
|
|
if [ "$(${pkgs.systemd}/bin/systemctl is-active phpfpm-nextcloud)" == "active" ]; then
|
|
|
|
${pkgs.systemd}/bin/systemctl restart phpfpm-nextcloud
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2024-02-21 22:49:20 +01:00
|
|
|
|
|
|
|
dgn-backups.jobs.nextcloud.settings.paths = [ "/var/lib/nextcloud" ];
|
|
|
|
dgn-backups.postgresDatabases = [ "nextcloud" ];
|
2023-09-11 11:17:30 +02:00
|
|
|
}
|