-
Notifications
You must be signed in to change notification settings - Fork 0
/
nextcloud.nix
67 lines (50 loc) · 1.69 KB
/
nextcloud.nix
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
# This module configures a NextCloud instance.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.services.nextcloud;
in {
options.my.services.nextcloud = {
domainName = mkOption {
default = null;
description = "domain name for NextCloud (must be given to enable the service)";
type = types.nullOr types.str;
};
};
config = mkIf (cfg.domainName != null) {
services.nginx.virtualHosts.${cfg.domainName} = {
forceSSL = true;
enableACME = true;
extraConfig = ''
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always; # six months
'';
# NOTE: the rest is configured by services.nextcloud.enable
};
services.nextcloud = {
enable = true;
hostName = cfg.domainName;
package = pkgs.nextcloud29;
database.createLocally = true;
# NOTE: services.nextcloud.config is only used for the initial setup, afterwards Nextcloud's stateful config takes precedence
config = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbname = "nextcloud";
adminpassFile = toString /var/lib/nextcloud-root-password;
adminuser = "root";
};
settings = {
maintenance_window_start = 3; # perform background maintenance tasks starting at 3AM, after borgbackup-root (at 02:00)
overwriteprotocol = "https";
default_phone_region = "DE";
};
phpOptions = {
"opcache.interned_strings_buffer" = "16"; # in MiB; default is 8, but NextCloud admin panel told me to increase it
};
};
services.postgresql = {
package = pkgs.postgresql_16;
dataDir = "/var/lib/postgresql/16";
};
};
}