From 70586f03fe3427faaf800f17726af5b651e2485c Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Tue, 14 May 2013 16:07:55 +0200 Subject: [PATCH] systemd.sockets: Add listenStreams option for specifying several sockets --- modules/system/boot/systemd-unit-options.nix | 10 ++++++++++ modules/system/boot/systemd.nix | 1 + 2 files changed, 11 insertions(+) diff --git a/modules/system/boot/systemd-unit-options.nix b/modules/system/boot/systemd-unit-options.nix index 9069d03b9f0..f863daf2250 100644 --- a/modules/system/boot/systemd-unit-options.nix +++ b/modules/system/boot/systemd-unit-options.nix @@ -215,6 +215,16 @@ rec { socketOptions = unitOptions // { + listenStreams = mkOption { + default = []; + types = types.listOf types.string; + example = [ "0.0.0.0:993" "/run/my-socket" ]; + description = '' + For each item in this list, a ListenStream + option in the [Socket] section will be created. + ''; + }; + socketConfig = mkOption { default = {}; example = { ListenStream = "/run/my-socket"; }; diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 4957bfeed34..11c2cfc6ace 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -275,6 +275,7 @@ let [Socket] ${attrsToSection def.socketConfig} + ${concatStringsSep "\n" (map (s: "ListenStream=${s}") def.listenStreams)} ''; };