2023-07-09 16:26:53 +00:00
|
|
|
{
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
format,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.aa.services.nextcloud;
|
|
|
|
in {
|
|
|
|
options.aa.services.nextcloud = with types; {
|
|
|
|
enable = mkEnableOption "nextcloud";
|
2023-07-16 17:53:02 +00:00
|
|
|
acmeCertName = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
If set to a non-empty string, forces SSL with the supplied acme
|
|
|
|
certificate.
|
|
|
|
'';
|
|
|
|
};
|
2023-07-09 16:26:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
age.secrets.nextcloud_admin = {
|
2023-11-18 16:29:25 +00:00
|
|
|
file = ../../../../secrets/nextcloud_admin.age;
|
2023-07-09 16:26:53 +00:00
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
2024-03-02 16:23:27 +00:00
|
|
|
package = pkgs.nextcloud28;
|
2023-07-09 16:26:53 +00:00
|
|
|
hostName = "nextcloud.kilonull.com";
|
|
|
|
https = true;
|
|
|
|
database.createLocally = true;
|
2023-07-09 22:58:51 +00:00
|
|
|
datadir = "/tank/nextcloud";
|
2023-07-09 16:26:53 +00:00
|
|
|
# Arbitrary large size
|
|
|
|
maxUploadSize = "16G";
|
2023-07-09 22:58:51 +00:00
|
|
|
configureRedis = true;
|
2024-03-02 16:23:27 +00:00
|
|
|
settings.log_type = "file";
|
2023-07-14 01:26:57 +00:00
|
|
|
poolSettings = {
|
|
|
|
pm = "dynamic";
|
|
|
|
"pm.max_children" = "64";
|
|
|
|
"pm.max_requests" = "500";
|
|
|
|
"pm.max_spare_servers" = "25";
|
|
|
|
"pm.min_spare_servers" = "10";
|
|
|
|
"pm.start_servers" = "15";
|
|
|
|
};
|
2023-07-09 16:26:53 +00:00
|
|
|
config = {
|
|
|
|
dbtype = "pgsql";
|
|
|
|
adminuser = "alejandro";
|
|
|
|
adminpassFile = config.age.secrets.nextcloud_admin.path;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# nextcloud module configures nginx, just need to specify SSL stuffs here
|
2023-07-16 17:53:02 +00:00
|
|
|
services.nginx.virtualHosts.${config.services.nextcloud.hostName} = mkIf (cfg.acmeCertName != "") {
|
2023-07-09 16:26:53 +00:00
|
|
|
forceSSL = true;
|
2023-07-16 17:53:02 +00:00
|
|
|
useACMEHost = cfg.acmeCertName;
|
2023-07-09 16:26:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [80 443];
|
|
|
|
};
|
|
|
|
}
|