fruitbasket/modules/nextcloud.nix

68 lines
1.5 KiB
Nix
Raw Normal View History

2022-11-18 17:00:20 +01:00
{ config, pkgs, lib, ... }:
let
domain = "nc.quitte.fugi.dev";
in
{
sops.secrets = {
postgres_nextcloud = {
owner = "nextcloud";
group = "nextcloud";
};
nextcloud_adminpass = {
owner = "nextcloud";
group = "nextcloud";
};
};
services = {
postgresql = {
enable = true;
ensureUsers = [
{
name = "nextcloud";
ensurePermissions = {
"DATABASE nextcloud" = "ALL PRIVILEGES";
};
}
];
ensureDatabases = [ "nextcloud" ];
};
nextcloud = {
enable = true;
2022-11-18 17:40:12 +01:00
package = pkgs.nextcloud25; # Use current latest nextcloud package
2022-11-18 17:00:20 +01:00
hostName = "${domain}";
2022-11-18 17:40:12 +01:00
https = true; # Use https for all urls
2022-11-18 17:00:20 +01:00
phpExtraExtensions = all: [
2022-11-18 17:40:12 +01:00
all.ldap # Enable ldap php extension
2022-11-18 17:00:20 +01:00
];
config = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql";
2022-11-18 17:13:58 +01:00
dbname = "nextcloud";
dbpassFile = config.sops.secrets.postgres_nextcloud.path;
2022-11-18 17:00:20 +01:00
adminpassFile = config.sops.secrets.nextcloud_adminpass.path;
adminuser = "root";
};
};
2022-11-18 17:40:12 +01:00
# Enable ACME and force SSL
2022-11-18 17:00:20 +01:00
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"];
};
}