git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #43812 from binarin/epmd-systemd-pr

epmd: Introduce erlang port mapper daemon service

commit3904016a3dd2d1949adab092be5f1b6af388db27 authorPeter Hoeg <peter@hoeg.com> dateMon 17 Sep 2018, 11:33 (8 years ago) parente352b27c00d17a
3 files changed+60
nixos/modules/module-list.nix+1 nixos/modules/services/networking/epmd.nix+56 pkgs/development/interpreters/erlang/generic-builder.nix+3
nixos/modules/module-list.nix+1
@@ -496,6 +496,7 @@
496496 ./services/networking/dnsdist.nix
497497 ./services/networking/dnsmasq.nix
498498 ./services/networking/ejabberd.nix
499+ ./services/networking/epmd.nix
499500 ./services/networking/fakeroute.nix
500501 ./services/networking/ferm.nix
501502 ./services/networking/firefox/sync-server.nix
nixos/modules/services/networking/epmd.nixnew file+56
@@ -0,0 +1,56 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.epmd;
7+
8+in
9+
10+{
11+ ###### interface
12+ options.services.epmd = {
13+ enable = mkOption {
14+ type = types.bool;
15+ default = false;
16+ description = ''
17+ Whether to enable socket activation for Erlang Port Mapper Daemon (epmd),
18+ which acts as a name server on all hosts involved in distributed
19+ Erlang computations.
20+ '';
21+ };
22+ package = mkOption {
23+ type = types.package;
24+ default = pkgs.erlang;
25+ description = ''
26+ The Erlang package to use to get epmd binary. That way you can re-use
27+ an Erlang runtime that is already installed for other purposes.
28+ '';
29+ };
30+ };
31+
32+ ###### implementation
33+ config = mkIf cfg.enable {
34+ systemd.sockets.epmd = rec {
35+ description = "Erlang Port Mapper Daemon Activation Socket";
36+ wantedBy = [ "sockets.target" ];
37+ before = wantedBy;
38+ socketConfig = {
39+ ListenStream = "4369";
40+ Accept = "false";
41+ };
42+ };
43+
44+ systemd.services.epmd = {
45+ description = "Erlang Port Mapper Daemon";
46+ after = [ "network.target" ];
47+ requires = [ "epmd.socket" ];
48+
49+ serviceConfig = {
50+ DynamicUser = true;
51+ ExecStart = "${cfg.package}/bin/epmd -systemd";
52+ Type = "notify";
53+ };
54+ };
55+ };
56+}
pkgs/development/interpreters/erlang/generic-builder.nix+3
@@ -3,6 +3,7 @@
33, openjdk ? null # javacSupport
44, unixODBC ? null # odbcSupport
55, libGLU_combined ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport
6+, withSystemd ? stdenv.isLinux, systemd # systemd support in epmd
67}:
78
89{ baseName ? "erlang"
@@ -53,6 +54,7 @@ in stdenv.mkDerivation ({
5354 ++ optionals wxSupport wxPackages2
5455 ++ optionals odbcSupport odbcPackages
5556 ++ optionals javacSupport javacPackages
57+ ++ optional withSystemd systemd
5658 ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]);
5759
5860 debugInfo = enableDebugInfo;
@@ -84,6 +86,7 @@ in stdenv.mkDerivation ({
8486 ++ optional javacSupport "--with-javac"
8587 ++ optional odbcSupport "--with-odbc=${unixODBC}"
8688 ++ optional wxSupport "--enable-wx"
89+ ++ optional withSystemd "--enable-systemd"
8790 ++ optional stdenv.isDarwin "--enable-darwin-64bit";
8891
8992 # install-docs will generate and install manpages and html docs