2014-09-02 15:08:56 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.prosody;
|
|
|
|
|
|
|
|
sslOpts = { ... }: {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
key = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.path;
|
2017-03-01 00:57:02 +00:00
|
|
|
description = "Path to the key file.";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
# TODO: rename to certificate to match the prosody config
|
2014-09-02 15:08:56 +00:00
|
|
|
cert = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.path;
|
2017-03-01 00:57:02 +00:00
|
|
|
description = "Path to the certificate file.";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOptions = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
|
|
|
description = "Extra SSL configuration options.";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
2017-03-01 00:57:02 +00:00
|
|
|
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
moduleOpts = {
|
2017-12-22 00:17:48 +00:00
|
|
|
# Generally required
|
2014-09-02 15:08:56 +00:00
|
|
|
roster = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Allow users to have a roster";
|
|
|
|
};
|
|
|
|
|
|
|
|
saslauth = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Authentication for clients and servers. Recommended if you want to log in.";
|
|
|
|
};
|
|
|
|
|
|
|
|
tls = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Add support for secure TLS on c2s/s2s connections";
|
|
|
|
};
|
|
|
|
|
|
|
|
dialback = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "s2s dialback support";
|
|
|
|
};
|
|
|
|
|
|
|
|
disco = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Service discovery";
|
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
# Not essential, but recommended
|
|
|
|
carbons = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
2017-12-22 00:17:48 +00:00
|
|
|
description = "Keep multiple clients in sync";
|
|
|
|
};
|
|
|
|
|
|
|
|
pep = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Enables users to publish their mood, activity, playing music and more";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
private = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Private XML storage (for room bookmarks, etc.)";
|
|
|
|
};
|
|
|
|
|
|
|
|
blocklist = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Allow users to block communications with other users";
|
|
|
|
};
|
|
|
|
|
|
|
|
vcard = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Allow users to set vCards";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Nice to have
|
2014-09-02 15:08:56 +00:00
|
|
|
version = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Replies to server version requests";
|
|
|
|
};
|
|
|
|
|
|
|
|
uptime = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Report how long server has been running";
|
|
|
|
};
|
|
|
|
|
|
|
|
time = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Let others know the time here on this server";
|
|
|
|
};
|
|
|
|
|
|
|
|
ping = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = true;
|
|
|
|
description = "Replies to XMPP pings with pongs";
|
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
register = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Allow users to register on this server using a client and change passwords";
|
|
|
|
};
|
|
|
|
|
|
|
|
mam = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Store messages in an archive and allow users to access it";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Admin interfaces
|
|
|
|
admin_adhoc = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Allows administration via an XMPP client that supports ad-hoc commands";
|
|
|
|
};
|
|
|
|
|
|
|
|
admin_telnet = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
2017-12-22 00:17:48 +00:00
|
|
|
description = "Opens telnet console interface on localhost port 5582";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
# HTTP modules
|
2014-09-02 15:08:56 +00:00
|
|
|
bosh = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
|
|
|
description = "Enable BOSH clients, aka 'Jabber over HTTP'";
|
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
websocket = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enable WebSocket support";
|
|
|
|
};
|
|
|
|
|
|
|
|
http_files = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
|
|
|
description = "Serve static files from a directory over HTTP";
|
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
# Other specific functionality
|
|
|
|
limits = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-10-15 01:57:00 +00:00
|
|
|
default = false;
|
2017-12-22 00:17:48 +00:00
|
|
|
description = "Enable bandwidth limiting for XMPP connections";
|
|
|
|
};
|
|
|
|
|
|
|
|
groups = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Shared roster support";
|
|
|
|
};
|
|
|
|
|
|
|
|
server_contact_info = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Publish contact information for this service";
|
|
|
|
};
|
|
|
|
|
|
|
|
announce = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Send announcement to all online users";
|
|
|
|
};
|
|
|
|
|
|
|
|
welcome = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Welcome users who register accounts";
|
|
|
|
};
|
|
|
|
|
|
|
|
watchregistrations = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Alert admins of registrations";
|
|
|
|
};
|
|
|
|
|
|
|
|
motd = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Send a message to users when they log in";
|
|
|
|
};
|
|
|
|
|
|
|
|
legacyauth = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Legacy authentication. Only used by some old clients and bots";
|
|
|
|
};
|
|
|
|
|
|
|
|
proxy65 = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enables a file transfer proxy service which clients behind NAT can use";
|
2014-10-15 01:57:00 +00:00
|
|
|
};
|
|
|
|
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2017-03-01 00:57:02 +00:00
|
|
|
toLua = x:
|
|
|
|
if builtins.isString x then ''"${x}"''
|
2017-12-22 00:17:48 +00:00
|
|
|
else if builtins.isBool x then (if x == true then "true" else "false")
|
2017-03-01 00:57:02 +00:00
|
|
|
else if builtins.isInt x then toString x
|
2017-12-22 00:17:48 +00:00
|
|
|
else if builtins.isList x then ''{ ${lib.concatStringsSep ", " (map (n: toLua n) x) } }''
|
2017-03-01 00:57:02 +00:00
|
|
|
else throw "Invalid Lua value";
|
|
|
|
|
|
|
|
createSSLOptsStr = o: ''
|
|
|
|
ssl = {
|
2018-04-26 09:12:36 +00:00
|
|
|
cafile = "/etc/ssl/certs/ca-bundle.crt";
|
2017-03-01 00:57:02 +00:00
|
|
|
key = "${o.key}";
|
|
|
|
certificate = "${o.cert}";
|
|
|
|
${concatStringsSep "\n" (mapAttrsToList (name: value: "${name} = ${toLua value};") o.extraOptions)}
|
|
|
|
};
|
|
|
|
'';
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
vHostOpts = { ... }: {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
# TODO: require attribute
|
|
|
|
domain = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "Domain name";
|
|
|
|
};
|
|
|
|
|
2015-03-30 11:45:07 +00:00
|
|
|
enabled = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the virtual host";
|
|
|
|
};
|
|
|
|
|
|
|
|
ssl = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.nullOr (types.submodule sslOpts);
|
2014-09-02 15:08:56 +00:00
|
|
|
default = null;
|
2017-03-01 00:57:02 +00:00
|
|
|
description = "Paths to SSL files";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
2014-09-02 15:08:56 +00:00
|
|
|
description = "Additional virtual host specific configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.prosody = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the prosody server";
|
|
|
|
};
|
|
|
|
|
2018-02-14 13:52:56 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
description = "Prosody package to use";
|
|
|
|
default = pkgs.prosody;
|
|
|
|
defaultText = "pkgs.prosody";
|
|
|
|
example = literalExample ''
|
|
|
|
pkgs.prosody.override {
|
|
|
|
withExtraLibs = [ pkgs.luaPackages.lpty ];
|
|
|
|
withCommunityModules = [ "auth_external" ];
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-04-09 12:19:42 +00:00
|
|
|
dataDir = mkOption {
|
|
|
|
type = types.string;
|
|
|
|
description = "Directory where Prosody stores its data";
|
|
|
|
default = "/var/lib/prosody";
|
|
|
|
};
|
|
|
|
|
2018-04-12 04:10:48 +00:00
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "prosody";
|
|
|
|
description = "User account under which prosody runs.";
|
|
|
|
};
|
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "prosody";
|
|
|
|
description = "Group account under which prosody runs.";
|
|
|
|
};
|
|
|
|
|
2014-09-02 15:08:56 +00:00
|
|
|
allowRegistration = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.bool;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = false;
|
|
|
|
description = "Allow account creation";
|
|
|
|
};
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
c2sRequireEncryption = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Force clients to use encrypted connections? This option will
|
|
|
|
prevent clients from authenticating unless they are using encryption.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
s2sRequireEncryption = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Force servers to use encrypted connections? This option will
|
|
|
|
prevent servers from authenticating unless they are using encryption.
|
|
|
|
Note that this is different from authentication.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
s2sSecureAuth = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Force certificate authentication for server-to-server connections?
|
|
|
|
This provides ideal security, but requires servers you communicate
|
|
|
|
with to support encryption AND present valid, trusted certificates.
|
|
|
|
For more information see https://prosody.im/doc/s2s#security
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
s2sInsecureDomains = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = [ "insecure.example.com" ];
|
|
|
|
description = ''
|
|
|
|
Some servers have invalid or self-signed certificates. You can list
|
|
|
|
remote domains here that will not be required to authenticate using
|
|
|
|
certificates. They will be authenticated using DNS instead, even
|
|
|
|
when s2s_secure_auth is enabled.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
s2sSecureDomains = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = [ "jabber.org" ];
|
|
|
|
description = ''
|
|
|
|
Even if you leave s2s_secure_auth disabled, you can still require valid
|
|
|
|
certificates for some domains by specifying a list here.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-09-02 15:08:56 +00:00
|
|
|
modules = moduleOpts;
|
|
|
|
|
|
|
|
extraModules = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.listOf types.str;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = [];
|
2017-03-01 00:57:02 +00:00
|
|
|
description = "Enable custom modules";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2018-03-22 02:40:46 +00:00
|
|
|
extraPluginPaths = mkOption {
|
|
|
|
type = types.listOf types.path;
|
|
|
|
default = [];
|
|
|
|
description = "Addtional path in which to look find plugins/modules";
|
|
|
|
};
|
|
|
|
|
2014-09-02 15:08:56 +00:00
|
|
|
virtualHosts = mkOption {
|
|
|
|
|
|
|
|
description = "Define the virtual hosts";
|
|
|
|
|
2016-09-11 09:06:35 +00:00
|
|
|
type = with types; loaOf (submodule vHostOpts);
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
example = {
|
|
|
|
myhost = {
|
|
|
|
domain = "my-xmpp-example-host.org";
|
2015-03-30 11:45:07 +00:00
|
|
|
enabled = true;
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
default = {
|
|
|
|
localhost = {
|
|
|
|
domain = "localhost";
|
2015-03-30 11:45:07 +00:00
|
|
|
enabled = true;
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
ssl = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.nullOr (types.submodule sslOpts);
|
2014-09-02 15:08:56 +00:00
|
|
|
default = null;
|
2017-03-01 00:57:02 +00:00
|
|
|
description = "Paths to SSL files";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
admins = mkOption {
|
2017-03-01 00:57:02 +00:00
|
|
|
type = types.listOf types.str;
|
2014-09-02 15:08:56 +00:00
|
|
|
default = [];
|
2017-03-01 00:57:02 +00:00
|
|
|
example = [ "admin1@example.com" "admin2@example.com" ];
|
|
|
|
description = "List of administrators of the current host";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = mkOption {
|
2016-10-23 17:33:41 +00:00
|
|
|
type = types.lines;
|
2017-03-01 00:57:02 +00:00
|
|
|
default = "";
|
2014-09-02 15:08:56 +00:00
|
|
|
description = "Additional prosody configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2018-03-22 02:40:46 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
environment.etc."prosody/prosody.cfg.lua".text = ''
|
|
|
|
|
2018-04-13 09:38:52 +00:00
|
|
|
pidfile = "/run/prosody/prosody.pid"
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
log = "*syslog"
|
|
|
|
|
2018-04-09 12:19:42 +00:00
|
|
|
data_path = "${cfg.dataDir}"
|
2018-03-22 02:40:46 +00:00
|
|
|
plugin_paths = {
|
|
|
|
${lib.concatStringsSep ", " (map (n: "\"${n}\"") cfg.extraPluginPaths) }
|
|
|
|
}
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
${ optionalString (cfg.ssl != null) (createSSLOptsStr cfg.ssl) }
|
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
admins = ${toLua cfg.admins}
|
|
|
|
|
|
|
|
-- we already build with libevent, so we can just enable it for a more performant server
|
|
|
|
use_libevent = true
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
modules_enabled = {
|
|
|
|
|
|
|
|
${ lib.concatStringsSep "\n\ \ " (lib.mapAttrsToList
|
2017-12-22 00:17:48 +00:00
|
|
|
(name: val: optionalString val "${toLua name};")
|
2014-09-02 15:08:56 +00:00
|
|
|
cfg.modules) }
|
2018-03-22 02:40:46 +00:00
|
|
|
${ lib.concatStringsSep "\n" (map (x: "${toLua x};") cfg.package.communityModules)}
|
2017-12-22 00:17:48 +00:00
|
|
|
${ lib.concatStringsSep "\n" (map (x: "${toLua x};") cfg.extraModules)}
|
|
|
|
};
|
2014-09-02 15:08:56 +00:00
|
|
|
|
2017-12-22 00:17:48 +00:00
|
|
|
allow_registration = ${toLua cfg.allowRegistration}
|
|
|
|
|
|
|
|
c2s_require_encryption = ${toLua cfg.c2sRequireEncryption}
|
|
|
|
|
|
|
|
s2s_require_encryption = ${toLua cfg.s2sRequireEncryption}
|
|
|
|
|
|
|
|
s2s_secure_auth = ${toLua cfg.s2sSecureAuth}
|
|
|
|
|
|
|
|
s2s_insecure_domains = ${toLua cfg.s2sInsecureDomains}
|
|
|
|
|
|
|
|
s2s_secure_domains = ${toLua cfg.s2sSecureDomains}
|
2014-09-02 15:08:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
${ cfg.extraConfig }
|
|
|
|
|
|
|
|
${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: ''
|
|
|
|
VirtualHost "${v.domain}"
|
2017-04-11 16:08:51 +00:00
|
|
|
enabled = ${boolToString v.enabled};
|
2014-09-02 15:08:56 +00:00
|
|
|
${ optionalString (v.ssl != null) (createSSLOptsStr v.ssl) }
|
|
|
|
${ v.extraConfig }
|
|
|
|
'') cfg.virtualHosts) }
|
|
|
|
'';
|
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.users.prosody = mkIf (cfg.user == "prosody") {
|
2014-09-02 15:08:56 +00:00
|
|
|
uid = config.ids.uids.prosody;
|
|
|
|
description = "Prosody user";
|
|
|
|
createHome = true;
|
2018-04-12 04:10:48 +00:00
|
|
|
inherit (cfg) group;
|
2018-04-09 12:19:42 +00:00
|
|
|
home = "${cfg.dataDir}";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.groups.prosody = mkIf (cfg.group == "prosody") {
|
2014-09-02 15:08:56 +00:00
|
|
|
gid = config.ids.gids.prosody;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.prosody = {
|
|
|
|
description = "Prosody XMPP server";
|
2017-02-23 15:05:06 +00:00
|
|
|
after = [ "network-online.target" ];
|
|
|
|
wants = [ "network-online.target" ];
|
2014-09-02 15:08:56 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2017-03-01 00:57:02 +00:00
|
|
|
restartTriggers = [ config.environment.etc."prosody/prosody.cfg.lua".source ];
|
2014-09-02 15:08:56 +00:00
|
|
|
serviceConfig = {
|
2018-04-12 04:10:48 +00:00
|
|
|
User = cfg.user;
|
|
|
|
Group = cfg.group;
|
2017-03-01 00:57:02 +00:00
|
|
|
Type = "forking";
|
2018-04-13 09:38:52 +00:00
|
|
|
RuntimeDirectory = [ "prosody" ];
|
|
|
|
PIDFile = "/run/prosody/prosody.pid";
|
2018-02-14 13:52:56 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/prosodyctl start";
|
2014-09-02 15:08:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|