blob: ff95f54506f5410dd76c175fdc981d888f32bb07 (
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
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
|
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkOption
types
literalExpression
;
cfg = config.services.nextcloud-whiteboard-server;
in
{
options.services.nextcloud-whiteboard-server = {
enable = mkEnableOption "Nextcloud backend server for the Whiteboard app";
settings = mkOption {
type = types.attrsOf types.str;
default = { };
description = ''
Settings to configure backend server. Especially the Nextcloud host
url has to be set. The required environment variable `JWT_SECRET_KEY`
should be set via the secrets option.
'';
example = literalExpression ''
{
NEXTCLOUD_URL = "https://nextcloud.example.org";
}
'';
};
secrets = lib.mkOption {
type = with types; listOf str;
description = ''
A list of files containing the various secrets. Should be in the
format expected by systemd's `EnvironmentFile` directory.
'';
default = [ ];
};
};
config = mkIf cfg.enable {
systemd.services.nextcloud-whiteboard-server = {
description = "Nextcloud backend server for the Whiteboard app";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
environment = cfg.settings;
serviceConfig = {
ExecStart = "${lib.getExe pkgs.nextcloud-whiteboard-server}";
WorkingDirectory = "%S/whiteboard";
StateDirectory = "whiteboard";
EnvironmentFile = [ cfg.secrets ];
DynamicUser = true;
};
};
};
meta.maintainers = with lib.maintainers; [ onny ];
}
|