2021-12-22 17:36:29 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let host = "cloud.felschr.com";
|
|
|
|
in {
|
2022-05-06 03:16:17 +02:00
|
|
|
age.secrets.nextcloud-admin = {
|
|
|
|
file = ../secrets/nextcloud/admin.age;
|
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
};
|
|
|
|
|
2021-12-22 17:36:29 +01:00
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.nextcloud23;
|
|
|
|
hostName = host;
|
|
|
|
https = true;
|
|
|
|
maxUploadSize = "10G";
|
|
|
|
config = {
|
|
|
|
adminuser = "admin";
|
2022-05-04 03:02:47 +02:00
|
|
|
adminpassFile = config.age.secrets.nextcloud-admin.path;
|
2021-12-22 17:36:29 +01:00
|
|
|
dbtype = "pgsql";
|
|
|
|
dbhost = "/run/postgresql";
|
|
|
|
};
|
|
|
|
autoUpdateApps.enable = true;
|
|
|
|
};
|
|
|
|
|
2021-12-22 17:42:46 +01:00
|
|
|
services.nginx.virtualHosts.${host} = {
|
2021-12-22 17:36:29 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = with config.services.nextcloud.config; {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [ dbname ];
|
|
|
|
ensureUsers = [{
|
|
|
|
name = dbuser;
|
|
|
|
ensurePermissions."DATABASE ${dbname}" = "ALL PRIVILEGES";
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
2022-02-07 23:52:38 +01:00
|
|
|
# Office
|
|
|
|
# TODO move to own config
|
|
|
|
virtualisation.oci-containers.containers.collabora-office = {
|
|
|
|
image = "collabora/code";
|
|
|
|
ports = [ "9980:9980" ];
|
|
|
|
environment = {
|
|
|
|
domain = builtins.replaceStrings [ "." ] [ "\\." ] "office.felschr.com";
|
|
|
|
extra_params = "--o:ssl.enable=false --o:ssl.termination=true";
|
|
|
|
};
|
|
|
|
extraOptions = [ "--network=host" ];
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts."office.felschr.com" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:9980";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-12-22 17:36:29 +01:00
|
|
|
# ensure that postgres is running *before* running the setup
|
|
|
|
systemd.services."nextcloud-setup" = {
|
|
|
|
requires = [ "postgresql.service" ];
|
|
|
|
after = [ "postgresql.service" ];
|
|
|
|
};
|
|
|
|
}
|