From 70d68f04787d0e168723000946368ad110db6476 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 11 Aug 2020 17:46:39 -0400 Subject: nixos/systemd: Add support for `listenDatagrams` This works exactly analogously to the existing `listenStreams`. --- nixos/modules/system/boot/systemd-unit-options.nix | 10 ++++++++++ nixos/modules/system/boot/systemd.nix | 1 + 2 files changed, 11 insertions(+) diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index c6dbb96951a..ac6fed440a2 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -379,6 +379,16 @@ in rec { ''; }; + listenDatagrams = mkOption { + default = []; + type = types.listOf types.str; + example = [ "0.0.0.0:993" "/run/my-socket" ]; + description = '' + For each item in this list, a ListenDatagram + option in the [Socket] section will be created. + ''; + }; + socketConfig = mkOption { default = {}; example = { ListenStream = "/run/my-socket"; }; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index a5f368c869a..d95f001a225 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -354,6 +354,7 @@ let [Socket] ${attrsToSection def.socketConfig} ${concatStringsSep "\n" (map (s: "ListenStream=${s}") def.listenStreams)} + ${concatStringsSep "\n" (map (s: "ListenDatagram=${s}") def.listenDatagrams)} ''; }; -- cgit 1.4.1