epmd: add ipv6 assertion

This commit is contained in:
happysalada 2021-08-27 16:47:11 +09:00 committed by Raphael Megzari
parent 0c8415335f
commit 8a56ac5db3

View file

@ -4,9 +4,7 @@ with lib;
let
cfg = config.services.epmd;
in
{
###### interface
options.services.epmd = {
@ -27,16 +25,31 @@ in
an Erlang runtime that is already installed for other purposes.
'';
};
listenStream = mkOption
{
type = types.str;
default = null;
description = ''
the listenStream used by the systemd socket.
see https://www.freedesktop.org/software/systemd/man/systemd.socket.html#ListenStream= for more informations.
use this to change the port epmd will run on.
if not defined, epmd will use "[::]:4369"
'';
};
};
###### implementation
config = mkIf cfg.enable {
assertions = [{
assertion = cfg.listenStream == null -> config.networking.enableIPv6;
message = "epmd listens by default on ipv6, enable ipv6 or change config.services.epmd.listenStream";
}];
systemd.sockets.epmd = rec {
description = "Erlang Port Mapper Daemon Activation Socket";
wantedBy = [ "sockets.target" ];
before = wantedBy;
socketConfig = {
ListenStream = "4369";
ListenStream = if cfg.listenStream != null then cfg.listenStream else "[::]:4369";
Accept = "false";
};
};