about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2021-08-27 16:47:11 +0900
committerRaphael Megzari <raphael@megzari.com>2021-08-30 19:51:00 +0900
commit8a56ac5db3e83a1e19bbe3a696cab83c6f21c359 (patch)
tree90d524ed5b73e9518796065f28c3d786e954e564
parent0c8415335fe3fb3347bd1f75813c6da1991f1112 (diff)
epmd: add ipv6 assertion
-rw-r--r--nixos/modules/services/networking/epmd.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/epmd.nix b/nixos/modules/services/networking/epmd.nix
index f7cdc0fe79c04..6fc8ed2aa0efb 100644
--- a/nixos/modules/services/networking/epmd.nix
+++ b/nixos/modules/services/networking/epmd.nix
@@ -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";
       };
     };