2023-05-19 11:42:43 +02:00
|
|
|
{ config, pkgs, ... }:
|
2023-01-24 11:58:36 +01:00
|
|
|
let
|
2023-09-19 13:47:08 +02:00
|
|
|
domain = "nextcloud.${config.networking.domain}";
|
2023-01-24 11:58:36 +01:00
|
|
|
in
|
|
|
|
{
|
2023-11-16 14:40:40 +01:00
|
|
|
age.secrets = {
|
2023-01-24 11:58:36 +01:00
|
|
|
"nextcloud/adminpass" = {
|
2023-11-16 14:40:40 +01:00
|
|
|
file = ../../../../secrets/nuc/nextcloud/adminpass.age;
|
2023-01-24 11:58:36 +01:00
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
nextcloud = {
|
|
|
|
enable = true;
|
2023-06-19 10:37:17 +02:00
|
|
|
package = pkgs.nextcloud27; # Use current latest nextcloud package
|
2023-01-24 11:58:36 +01:00
|
|
|
hostName = "${domain}";
|
|
|
|
https = true; # Use https for all urls
|
|
|
|
config = {
|
|
|
|
dbtype = "pgsql";
|
|
|
|
dbuser = "nextcloud";
|
|
|
|
dbhost = "/run/postgresql";
|
|
|
|
dbname = "nextcloud";
|
2023-11-16 14:40:40 +01:00
|
|
|
adminpassFile = config.age.secrets."nextcloud/adminpass".path;
|
2023-01-24 12:39:53 +01:00
|
|
|
adminuser = "rouven";
|
2023-01-24 11:58:36 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Enable ACME and force SSL
|
|
|
|
nginx = {
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
virtualHosts = {
|
|
|
|
"${domain}" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# ensure that postgres is running *before* running the setup
|
|
|
|
systemd.services."nextcloud-setup" = {
|
|
|
|
requires = [ "postgresql.service" ];
|
|
|
|
after = [ "postgresql.service" ];
|
|
|
|
};
|
2023-07-30 19:41:51 +02:00
|
|
|
systemd.services."nextcloud-cron" = {
|
|
|
|
requires = [ "postgresql.service" ];
|
|
|
|
after = [ "postgresql.service" ];
|
|
|
|
};
|
2023-01-24 11:58:36 +01:00
|
|
|
}
|