summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2020-08-11 17:46:39 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-08-11 22:08:19 +0000
commit70d68f04787d0e168723000946368ad110db6476 (patch)
tree0d465b45ddf9e5ca721693705f69bf1ee83b0cf5
parent4d9dec0aba78a6fd3a00b051f6a42c98cdf286c0 (diff)
downloadnixpkgs-70d68f04787d0e168723000946368ad110db6476.tar
nixpkgs-70d68f04787d0e168723000946368ad110db6476.tar.gz
nixpkgs-70d68f04787d0e168723000946368ad110db6476.tar.bz2
nixpkgs-70d68f04787d0e168723000946368ad110db6476.tar.lz
nixpkgs-70d68f04787d0e168723000946368ad110db6476.tar.xz
nixpkgs-70d68f04787d0e168723000946368ad110db6476.tar.zst
nixpkgs-70d68f04787d0e168723000946368ad110db6476.zip
nixos/systemd: Add support for `listenDatagrams`
This works exactly analogously to the existing `listenStreams`.
-rw-r--r--nixos/modules/system/boot/systemd-unit-options.nix10
-rw-r--r--nixos/modules/system/boot/systemd.nix1
2 files changed, 11 insertions, 0 deletions
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 <literal>ListenDatagram</literal>
+        option in the <literal>[Socket]</literal> 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)}
         '';
     };