2021-10-16 21:23:55 +03:00
|
|
|
{ config, lib, pkgs, tools, ... }:
|
2021-11-27 01:10:36 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.nextcloud.config;
|
|
|
|
in
|
2021-10-16 21:23:55 +03:00
|
|
|
{
|
|
|
|
age.secrets = {
|
|
|
|
nextcloud-adminpass = {
|
|
|
|
file = ../../../../secrets/nextcloud-adminpass.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
|
|
|
nextcloud-dbpass = {
|
|
|
|
file = ../../../../secrets/nextcloud-dbpass.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.nextcloud = {
|
2022-03-12 19:27:39 +02:00
|
|
|
package = pkgs.nextcloud23;
|
2021-10-16 21:23:55 +03:00
|
|
|
enable = true;
|
|
|
|
https = true;
|
|
|
|
hostName = "storage.${tools.meta.domain}";
|
|
|
|
home = "/srv/storage/www-app/nextcloud";
|
|
|
|
maxUploadSize = "4G";
|
|
|
|
enableImagemagick = true;
|
|
|
|
caching = with lib; flip genAttrs (_: true) [
|
|
|
|
"apcu" "redis"
|
|
|
|
];
|
|
|
|
|
|
|
|
autoUpdateApps = {
|
|
|
|
enable = true;
|
|
|
|
startAt = "02:00";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
dbhost = "/run/postgresql";
|
|
|
|
dbtype = "pgsql";
|
|
|
|
dbname = "storage";
|
|
|
|
dbuser = "storage";
|
|
|
|
dbpassFile = config.age.secrets.nextcloud-adminpass.path;
|
|
|
|
|
|
|
|
overwriteProtocol = "https";
|
|
|
|
|
|
|
|
adminuser = "sa";
|
|
|
|
adminpassFile = config.age.secrets.nextcloud-dbpass.path;
|
|
|
|
};
|
|
|
|
};
|
2021-11-27 01:10:36 +02:00
|
|
|
services.postgresql.authentication = "local ${cfg.dbname} ${cfg.dbuser} md5";
|
2021-10-16 21:23:55 +03:00
|
|
|
services.nginx.virtualHosts."${config.services.nextcloud.hostName}" = {
|
|
|
|
addSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
};
|
2021-12-03 00:39:54 +02:00
|
|
|
systemd.services = {
|
|
|
|
phpfpm-nextcloud.aliases = [ "nextcloud.service" ];
|
|
|
|
nextcloud-setup.after = [ "postgresql.service" ];
|
|
|
|
};
|
2021-10-16 21:23:55 +03:00
|
|
|
}
|