Merge pull request #43812 from binarin/epmd-systemd-pr

epmd: Introduce erlang port mapper daemon service
This commit is contained in:
Peter Hoeg 2018-09-17 11:33:09 +08:00 committed by GitHub
commit 3904016a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 0 deletions

View file

@ -496,6 +496,7 @@
./services/networking/dnsdist.nix
./services/networking/dnsmasq.nix
./services/networking/ejabberd.nix
./services/networking/epmd.nix
./services/networking/fakeroute.nix
./services/networking/ferm.nix
./services/networking/firefox/sync-server.nix

View file

@ -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";
};
};
};
}

View file

@ -3,6 +3,7 @@
, openjdk ? null # javacSupport
, unixODBC ? null # odbcSupport
, libGLU_combined ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport
, withSystemd ? stdenv.isLinux, systemd # systemd support in epmd
}:
{ baseName ? "erlang"
@ -53,6 +54,7 @@ in stdenv.mkDerivation ({
++ optionals wxSupport wxPackages2
++ optionals odbcSupport odbcPackages
++ optionals javacSupport javacPackages
++ optional withSystemd systemd
++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]);
debugInfo = enableDebugInfo;
@ -84,6 +86,7 @@ in stdenv.mkDerivation ({
++ optional javacSupport "--with-javac"
++ optional odbcSupport "--with-odbc=${unixODBC}"
++ optional wxSupport "--enable-wx"
++ optional withSystemd "--enable-systemd"
++ optional stdenv.isDarwin "--enable-darwin-64bit";
# install-docs will generate and install manpages and html docs