about summary refs log tree commit diff
path: root/nixos/tests/rsyncd.nix
diff options
context:
space:
mode:
authorEmery Hemingway <ehmry@posteo.net>2021-01-26 11:12:20 +0100
committerEmery Hemingway <ehmry@posteo.net>2021-01-28 11:22:31 +0100
commitf32d7e4e032e83955659ba31bdcdc605ff0dfbab (patch)
treecd0cd84008f9c39bfaf43ea2edd1eaf5ec670e08 /nixos/tests/rsyncd.nix
parent750510ee7cf588f317cddb7810ef2f28b8d66fb7 (diff)
nixos: add services.rsyncd.socketActivated option
Define systemd-socket activation using the upstream configuration
files as a reference. The "rsyncd" systemd unit has been renamed
to "rsync" for consistency with upstream.
Diffstat (limited to 'nixos/tests/rsyncd.nix')
-rw-r--r--nixos/tests/rsyncd.nix39
1 files changed, 25 insertions, 14 deletions
diff --git a/nixos/tests/rsyncd.nix b/nixos/tests/rsyncd.nix
index 3639320f645d1..44464e42f28d4 100644
--- a/nixos/tests/rsyncd.nix
+++ b/nixos/tests/rsyncd.nix
@@ -2,24 +2,35 @@ import ./make-test-python.nix ({ pkgs, ... }: {
   name = "rsyncd";
   meta.maintainers = with pkgs.lib.maintainers; [ ehmry ];
 
-  nodes.machine.services.rsyncd = {
-    enable = true;
-    settings = {
-      global = {
-        "reverse lookup" = false;
-        "forward lookup" = false;
+  nodes = let
+    mkNode = socketActivated:
+      { config, ... }: {
+        networking.firewall.allowedTCPPorts = [ config.services.rsyncd.port ];
+        services.rsyncd = {
+          enable = true;
+          inherit socketActivated;
+          settings = {
+            global = {
+              "reverse lookup" = false;
+              "forward lookup" = false;
+            };
+            tmp = {
+              path = "/nix/store";
+              comment = "test module";
+            };
+          };
+        };
       };
-      tmp = {
-        path = "/nix/store";
-        comment = "test module";
-      };
-
-    };
+  in {
+    a = mkNode false;
+    b = mkNode true;
   };
 
   testScript = ''
     start_all()
-    machine.wait_for_unit("rsyncd")
-    machine.succeed("rsync localhost::")
+    a.wait_for_unit("rsync")
+    b.wait_for_unit("sockets.target")
+    b.succeed("rsync a::")
+    a.succeed("rsync b::")
   '';
 })