nixos-config/services/nextcloud.nix

71 lines
1.8 KiB
Nix
Raw Normal View History

2021-12-22 17:36:29 +01:00
{ config, pkgs, ... }:
let host = "cloud.felschr.com";
in {
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" ];
2022-05-19 00:50:41 +02:00
environment = let
mkAlias = domain:
"https://" + (builtins.replaceStrings [ "." ] [ "\\." ] domain)
+ ":443";
in {
aliasgroup1 = mkAlias "office.felschr.com";
aliasgroup2 = mkAlias "cloud.felschr.com";
2022-02-07 23:52:38 +01:00
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" ];
};
}