tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
nixos/matrix-dendrite: rename to dendrite
Robert Schütz
4 years ago
f82c6fdf
007cab96
+14
-14
2 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
misc
dendrite.nix
+1
-1
nixos/modules/module-list.nix
···
472
./services/misc/cgminer.nix
473
./services/misc/confd.nix
474
./services/misc/couchpotato.nix
0
475
./services/misc/devmon.nix
476
./services/misc/dictd.nix
477
./services/misc/duckling.nix
···
514
./services/misc/mame.nix
515
./services/misc/matrix-appservice-discord.nix
516
./services/misc/matrix-appservice-irc.nix
517
-
./services/misc/matrix-dendrite.nix
518
./services/misc/matrix-synapse.nix
519
./services/misc/mautrix-telegram.nix
520
./services/misc/mbpfan.nix
···
472
./services/misc/cgminer.nix
473
./services/misc/confd.nix
474
./services/misc/couchpotato.nix
475
+
./services/misc/dendrite.nix
476
./services/misc/devmon.nix
477
./services/misc/dictd.nix
478
./services/misc/duckling.nix
···
515
./services/misc/mame.nix
516
./services/misc/matrix-appservice-discord.nix
517
./services/misc/matrix-appservice-irc.nix
0
518
./services/misc/matrix-synapse.nix
519
./services/misc/mautrix-telegram.nix
520
./services/misc/mbpfan.nix
+13
-13
nixos/modules/services/misc/matrix-dendrite.nix
nixos/modules/services/misc/dendrite.nix
···
1
{ config, lib, pkgs, ... }:
2
let
3
-
cfg = config.services.matrix-dendrite;
4
settingsFormat = pkgs.formats.yaml { };
5
configurationYaml = settingsFormat.generate "dendrite.yaml" cfg.settings;
6
-
workingDir = "/var/lib/matrix-dendrite";
7
in
8
{
9
-
options.services.matrix-dendrite = {
10
enable = lib.mkEnableOption "matrix.org dendrite";
11
httpPort = lib.mkOption {
12
type = lib.types.nullOr lib.types.port;
···
24
};
25
tlsCert = lib.mkOption {
26
type = lib.types.nullOr lib.types.path;
27
-
example = "/var/lib/matrix-dendrite/server.cert";
28
default = null;
29
description = ''
30
The path to the TLS certificate.
···
36
};
37
tlsKey = lib.mkOption {
38
type = lib.types.nullOr lib.types.path;
39
-
example = "/var/lib/matrix-dendrite/server.key";
40
default = null;
41
description = ''
42
The path to the TLS key.
···
48
};
49
environmentFile = lib.mkOption {
50
type = lib.types.nullOr lib.types.path;
51
-
example = "/var/lib/matrix-dendrite/registration_secret";
52
default = null;
53
description = ''
54
Environment file as defined in <citerefentry>
···
62
63
<programlisting>
64
# snippet of dendrite-related config
65
-
services.matrix-dendrite.settings.client_api.registration_shared_secret = "$REGISTRATION_SHARED_SECRET";
66
</programlisting>
67
68
<programlisting>
···
140
'';
141
}];
142
143
-
systemd.services.matrix-dendrite = {
144
description = "Dendrite Matrix homeserver";
145
after = [
146
"network.target"
···
149
serviceConfig = {
150
Type = "simple";
151
DynamicUser = true;
152
-
StateDirectory = "matrix-dendrite";
153
WorkingDirectory = workingDir;
154
-
RuntimeDirectory = "matrix-dendrite";
155
RuntimeDirectoryMode = "0700";
156
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
157
ExecStartPre =
158
if (cfg.environmentFile != null) then ''
159
${pkgs.envsubst}/bin/envsubst \
160
-i ${configurationYaml} \
161
-
-o /run/matrix-dendrite/dendrite.yaml
162
'' else ''
163
-
${pkgs.coreutils}/bin/cp ${configurationYaml} /run/matrix-dendrite/dendrite.yaml
164
'';
165
ExecStart = lib.strings.concatStringsSep " " ([
166
"${pkgs.dendrite}/bin/dendrite-monolith-server"
167
-
"--config /run/matrix-dendrite/dendrite.yaml"
168
] ++ lib.optionals (cfg.httpPort != null) [
169
"--http-bind-address :${builtins.toString cfg.httpPort}"
170
] ++ lib.optionals (cfg.httpsPort != null) [
···
1
{ config, lib, pkgs, ... }:
2
let
3
+
cfg = config.services.dendrite;
4
settingsFormat = pkgs.formats.yaml { };
5
configurationYaml = settingsFormat.generate "dendrite.yaml" cfg.settings;
6
+
workingDir = "/var/lib/dendrite";
7
in
8
{
9
+
options.services.dendrite = {
10
enable = lib.mkEnableOption "matrix.org dendrite";
11
httpPort = lib.mkOption {
12
type = lib.types.nullOr lib.types.port;
···
24
};
25
tlsCert = lib.mkOption {
26
type = lib.types.nullOr lib.types.path;
27
+
example = "/var/lib/dendrite/server.cert";
28
default = null;
29
description = ''
30
The path to the TLS certificate.
···
36
};
37
tlsKey = lib.mkOption {
38
type = lib.types.nullOr lib.types.path;
39
+
example = "/var/lib/dendrite/server.key";
40
default = null;
41
description = ''
42
The path to the TLS key.
···
48
};
49
environmentFile = lib.mkOption {
50
type = lib.types.nullOr lib.types.path;
51
+
example = "/var/lib/dendrite/registration_secret";
52
default = null;
53
description = ''
54
Environment file as defined in <citerefentry>
···
62
63
<programlisting>
64
# snippet of dendrite-related config
65
+
services.dendrite.settings.client_api.registration_shared_secret = "$REGISTRATION_SHARED_SECRET";
66
</programlisting>
67
68
<programlisting>
···
140
'';
141
}];
142
143
+
systemd.services.dendrite = {
144
description = "Dendrite Matrix homeserver";
145
after = [
146
"network.target"
···
149
serviceConfig = {
150
Type = "simple";
151
DynamicUser = true;
152
+
StateDirectory = "dendrite";
153
WorkingDirectory = workingDir;
154
+
RuntimeDirectory = "dendrite";
155
RuntimeDirectoryMode = "0700";
156
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
157
ExecStartPre =
158
if (cfg.environmentFile != null) then ''
159
${pkgs.envsubst}/bin/envsubst \
160
-i ${configurationYaml} \
161
+
-o /run/dendrite/dendrite.yaml
162
'' else ''
163
+
${pkgs.coreutils}/bin/cp ${configurationYaml} /run/dendrite/dendrite.yaml
164
'';
165
ExecStart = lib.strings.concatStringsSep " " ([
166
"${pkgs.dendrite}/bin/dendrite-monolith-server"
167
+
"--config /run/dendrite/dendrite.yaml"
168
] ++ lib.optionals (cfg.httpPort != null) [
169
"--http-bind-address :${builtins.toString cfg.httpPort}"
170
] ++ lib.optionals (cfg.httpsPort != null) [