hosts/hosts/nextcloud.nix

92 lines
2.4 KiB
Nix

{ config, lib, pkgs, ... }:
let
hostName = (lib.toLower config.networking.hostName) + ".gvfr.de";
in
{
services.nextcloud = {
enable = true;
https = true;
package = pkgs.nextcloud31;
hostName = hostName;
datadir = "/data/nextcloud";
settings = {
trusted_domains = [
((lib.toLower config.networking.hostName) + ".lan")
(lib.toLower config.networking.hostName)
];
blacklisted_files = [];
trashbin_retention_obligation = "auto, 14";
"simpleSignUpLink.shown" = false;
};
config = {
dbtype = "pgsql";
dbhost = "/run/postgresql";
adminpassFile = "/secrets/nextcloud_admin_password.txt";
};
caching.redis = true;
};
services.postgresql = {
enable = true;
ensureUsers = [
{
name = "nextcloud";
ensureDBOwnership = true;
}
# {
# name = "superuser";
# ensurePermissions = {
# "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
# };
# }
];
ensureDatabases = [ "nextcloud" ];
};
# Ensure that postgres is running *before* running the setup
systemd.services."nextcloud-setup" = {
requires = ["postgresql.service"];
after = ["postgresql.service"];
};
networking.firewall.allowedTCPPorts = [ 80 443 4431 ];
services.nginx = {
virtualHosts.${hostName} = {
forceSSL = true;
enableACME = true;
};
defaultListen = [
{
addr = "[::]";
port = 443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 443;
ssl = true;
}
{
addr = "[::]";
port = 80;
ssl = false;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
{
addr = "[::]";
port = 4431;
ssl = true;
proxyProtocol = true;
}
];
};
users.extraGroups.music = {
members = [ "nextcloud" ];
};
}