forked from wurzel/fruitbasket
67 lines
1.4 KiB
Nix
67 lines
1.4 KiB
Nix
|
{ 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;
|
||
|
package = pkgs.nextcloud25;
|
||
|
hostName = "${domain}";
|
||
|
https = true;
|
||
|
phpExtraExtensions = all: [
|
||
|
all.ldap
|
||
|
];
|
||
|
config = {
|
||
|
dbtype = "pgsql";
|
||
|
dbuser = "nextcloud";
|
||
|
dbhost = "/run/postgresql";
|
||
|
dbname = "nextcloud";
|
||
|
dbpassFile = config.sops.secrets.postgres_nextcloud.path;
|
||
|
adminpassFile = config.sops.secrets.nextcloud_adminpass.path;
|
||
|
adminuser = "root";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
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"];
|
||
|
};
|
||
|
}
|