blob: 2e409707fa35bd3bdafc9757938d2b938cfbbcc3 (
plain) (
blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{
config,
pkgs,
lib,
...
}: let
cfg = config.vhack.nextcloud;
in {
options.vhack.nextcloud = {
enable = lib.mkEnableOption "a sophisticated nextcloud setup";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.nextcloud31;
description = "The nextcloud package to use";
};
hostname = lib.mkOption {
type = lib.types.str;
description = "The nextcloud hostname (fqdn)";
};
adminpassFile = lib.mkOption {
type = lib.types.path;
description = "The age encrypted admin password file";
};
};
config = lib.mkIf cfg.enable {
vhack = {
nginx.enable = true;
postgresql.enable = true;
persist.directories = [
"/var/lib/nextcloud"
];
};
age.secrets = {
adminpassFile = {
file = cfg.adminpassFile;
mode = "0700";
owner = "nextcloud";
group = "nextcloud";
};
};
services = {
nextcloud = {
enable = true;
configureRedis = true;
config = {
adminuser = "admin";
adminpassFile = config.age.secrets.adminpassFile.path;
dbname = "nextcloud";
dbuser = "nextcloud";
dbtype = "pgsql";
};
database.createLocally = true;
hostName = cfg.hostname;
https = true;
maxUploadSize = "5G";
package = cfg.package;
settings = {
default_phone_region = "DE";
};
};
nginx.virtualHosts.${cfg.hostname} = {
forceSSL = true;
enableACME = true;
};
};
users = {
users = {
"nextcloud".uid = config.vhack.constants.ids.uids.nextcloud;
"redis-nextcloud".uid = config.vhack.constants.ids.uids.redis-nextcloud;
};
groups = {
"nextcloud".gid = config.vhack.constants.ids.gids.nextcloud;
"redis-nextcloud".gid = config.vhack.constants.ids.gids.redis-nextcloud;
};
};
};
}
|