l 3 ejabberd: take config from tv
This commit is contained in:
parent
8f3639df51
commit
6eab08eef6
@ -10,7 +10,7 @@ in toFile "ejabberd.conf" ''
|
|||||||
[
|
[
|
||||||
{5222, ejabberd_c2s, [
|
{5222, ejabberd_c2s, [
|
||||||
starttls,
|
starttls,
|
||||||
{certfile, ${toErlang cfg.certfile}},
|
{certfile, ${toErlang cfg.certfile.path}},
|
||||||
{access, c2s},
|
{access, c2s},
|
||||||
{shaper, c2s_shaper},
|
{shaper, c2s_shaper},
|
||||||
{max_stanza_size, 65536}
|
{max_stanza_size, 65536}
|
||||||
@ -27,7 +27,7 @@ in toFile "ejabberd.conf" ''
|
|||||||
]}
|
]}
|
||||||
]}.
|
]}.
|
||||||
{s2s_use_starttls, required}.
|
{s2s_use_starttls, required}.
|
||||||
{s2s_certfile, ${toErlang cfg.s2s_certfile}}.
|
{s2s_certfile, ${toErlang cfg.s2s_certfile.path}}.
|
||||||
{auth_method, internal}.
|
{auth_method, internal}.
|
||||||
{shaper, normal, {maxrate, 1000}}.
|
{shaper, normal, {maxrate, 1000}}.
|
||||||
{shaper, fast, {maxrate, 50000}}.
|
{shaper, fast, {maxrate, 50000}}.
|
||||||
|
@ -4,7 +4,12 @@ in {
|
|||||||
options.lass.ejabberd = {
|
options.lass.ejabberd = {
|
||||||
enable = mkEnableOption "lass.ejabberd";
|
enable = mkEnableOption "lass.ejabberd";
|
||||||
certfile = mkOption {
|
certfile = mkOption {
|
||||||
type = types.str;
|
type = types.secret-file;
|
||||||
|
default = {
|
||||||
|
path = "${cfg.user.home}/ejabberd.pem";
|
||||||
|
owner = cfg.user;
|
||||||
|
source-path = "/var/lib/acme/lassul.us/full.pem";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
hosts = mkOption {
|
hosts = mkOption {
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
@ -17,12 +22,11 @@ in {
|
|||||||
export EJABBERD_CONFIG_PATH=${shell.escape (import ./config.nix args)}
|
export EJABBERD_CONFIG_PATH=${shell.escape (import ./config.nix args)}
|
||||||
exec ${pkgs.ejabberd}/bin/ejabberdctl \
|
exec ${pkgs.ejabberd}/bin/ejabberdctl \
|
||||||
--logs ${shell.escape cfg.user.home} \
|
--logs ${shell.escape cfg.user.home} \
|
||||||
--spool ${shell.escape cfg.user.home} \
|
|
||||||
"$@"
|
"$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
s2s_certfile = mkOption {
|
s2s_certfile = mkOption {
|
||||||
type = types.str;
|
type = types.secret-file;
|
||||||
default = cfg.certfile;
|
default = cfg.certfile;
|
||||||
};
|
};
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
@ -36,9 +40,15 @@ in {
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.pkgs.ejabberdctl ];
|
environment.systemPackages = [ cfg.pkgs.ejabberdctl ];
|
||||||
|
|
||||||
|
krebs.secret.files = {
|
||||||
|
ejabberd-certfile = cfg.certfile;
|
||||||
|
ejabberd-s2s_certfile = cfg.s2s_certfile;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.ejabberd = {
|
systemd.services.ejabberd = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
requires = [ "secret.service" ];
|
||||||
|
after = [ "network.target" "secret.service" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = "yes";
|
RemainAfterExit = "yes";
|
||||||
|
Loading…
Reference in New Issue
Block a user