summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2018-09-17 11:33:09 +0800
committerGitHub <noreply@github.com>2018-09-17 11:33:09 +0800
commit3904016a3dd2d1949adab092be5f1b6af388db27 (patch)
treeda51d1c3ec280776934b8736098676b845b32acd /nixos/modules/services/networking
parente352b2725c065c979a008fcb876ba688d87b3034 (diff)
parentc00d17aae388bca8bf5657a2f312a1e436e7aef0 (diff)
downloadnixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar.gz
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar.bz2
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar.lz
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar.xz
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.tar.zst
nixlib-3904016a3dd2d1949adab092be5f1b6af388db27.zip
Merge pull request #43812 from binarin/epmd-systemd-pr
 epmd: Introduce erlang port mapper daemon service
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/epmd.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/epmd.nix b/nixos/modules/services/networking/epmd.nix
new file mode 100644
index 000000000000..692b75e4f086
--- /dev/null
+++ b/nixos/modules/services/networking/epmd.nix
@@ -0,0 +1,56 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.epmd;
+
+in
+
+{
+  ###### interface
+  options.services.epmd = {
+    enable = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Whether to enable socket activation for Erlang Port Mapper Daemon (epmd),
+        which acts as a name server on all hosts involved in distributed
+        Erlang computations.
+      '';
+    };
+    package = mkOption {
+      type = types.package;
+      default = pkgs.erlang;
+      description = ''
+        The Erlang package to use to get epmd binary. That way you can re-use
+        an Erlang runtime that is already installed for other purposes.
+      '';
+    };
+  };
+
+  ###### implementation
+  config = mkIf cfg.enable {
+    systemd.sockets.epmd = rec {
+      description = "Erlang Port Mapper Daemon Activation Socket";
+      wantedBy = [ "sockets.target" ];
+      before = wantedBy;
+      socketConfig = {
+        ListenStream = "4369";
+        Accept = "false";
+      };
+    };
+
+    systemd.services.epmd = {
+      description = "Erlang Port Mapper Daemon";
+      after = [ "network.target" ];
+      requires = [ "epmd.socket" ];
+
+      serviceConfig = {
+        DynamicUser = true;
+        ExecStart = "${cfg.package}/bin/epmd -systemd";
+        Type = "notify";
+      };
+    };
+  };
+}