diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index dd6519ff9361..78915a8c1db3 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -827,8 +827,10 @@ in { predictable-interface-names = handleTest ./predictable-interface-names.nix {}; pretalx = runTest ./web-apps/pretalx.nix; pretix = runTest ./web-apps/pretix.nix; - printing-socket = handleTest ./printing.nix { socket = true; }; - printing-service = handleTest ./printing.nix { socket = false; }; + printing-socket = handleTest ./printing.nix { socket = true; listenTcp = true; }; + printing-service = handleTest ./printing.nix { socket = false; listenTcp = true; }; + printing-socket-notcp = handleTest ./printing.nix { socket = true; listenTcp = false; }; + printing-service-notcp = handleTest ./printing.nix { socket = false; listenTcp = false; }; private-gpt = handleTest ./private-gpt.nix {}; privatebin = runTest ./privatebin.nix; privoxy = handleTest ./privoxy.nix {}; diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix index c612345e9583..5f719a5d97c1 100644 --- a/nixos/tests/printing.nix +++ b/nixos/tests/printing.nix @@ -3,6 +3,7 @@ import ./make-test-python.nix ( { pkgs , socket ? true # whether to use socket activation +, listenTcp ? true # whether to open port 631 on client , ... }: @@ -39,9 +40,10 @@ in }]; }; - nodes.client = { ... }: { + nodes.client = { lib, ... }: { services.printing.enable = true; services.printing.startWhenNeeded = socket; + services.printing.listenAddresses = lib.mkIf (!listenTcp) []; # Add printer to the client as well, via IPP. hardware.printers.ensurePrinters = [{ name = "DeskjetRemote"; @@ -67,7 +69,7 @@ in assert "/var/run/cups/cups.sock" in client.succeed("lpstat -H") with subtest("HTTP server is available too"): - client.succeed("curl --fail http://localhost:631/") + ${lib.optionalString listenTcp ''client.succeed("curl --fail http://localhost:631/")''} client.succeed(f"curl --fail http://{server.name}:631/") server.fail(f"curl --fail --connect-timeout 2 http://{client.name}:631/") diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix index 566632d74d78..085ecdbed827 100644 --- a/pkgs/misc/cups/default.nix +++ b/pkgs/misc/cups/default.nix @@ -141,6 +141,8 @@ stdenv.mkDerivation rec { cups-pdf printing-service printing-socket + printing-service-notcp + printing-socket-notcp ; };