blob: e38401b15b5975d02ad2f097d4787d8a10d10f38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{ config, lib, pkgs, ... }:
let
cfg = config.orbekk.nextcloud;
in
{
options = {
orbekk.nextcloud = {
enable = lib.mkEnableOption "Enable nextcloud server";
};
};
config = lib.mkIf cfg.enable {
services.nextcloud = {
enable = true;
package = pkgs.nextcloud24;
hostName = "nextcloud.orbekk.com";
config = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud";
adminpassFile = "/opt/secret/nextcloud/admin-pass-file";
adminuser = "root";
};
maxUploadSize = "16G";
autoUpdateApps.enable = true;
https = true;
};
services.postgresql = {
enable = true;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [
{ name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}
];
};
users.extraUsers.nextcloud.extraGroups = ["readonly"];
systemd.services."nextcloud-setup" = {
requires = ["postgresql.service"];
after = ["postgresql.service"];
};
};
}
|