nixos-config/hosts/nuc/modules/nextcloud/default.nix

60 lines
1.3 KiB
Nix
Raw Normal View History

2023-01-24 11:58:36 +01:00
{ config, pkgs, lib, ... }:
let
domain = "nextcloud.rfive.de";
in
{
sops.secrets = {
"nextcloud/adminpass" = {
owner = "nextcloud";
group = "nextcloud";
};
};
services = {
postgresql = {
enable = true;
ensureUsers = [
{
name = "nextcloud";
ensurePermissions = {
"DATABASE nextcloud" = "ALL PRIVILEGES";
};
}
];
ensureDatabases = [ "nextcloud" ];
};
nextcloud = {
enable = true;
2023-03-26 14:27:15 +02:00
package = pkgs.nextcloud26; # 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";
adminpassFile = config.sops.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" ];
};
}