summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2018-02-23 13:41:15 +0300
committerNikolay Amiantov <ab@fmap.me>2018-02-23 18:43:51 +0300
commitcf4c07734364e7e59414f486381360b42a9f88ea (patch)
tree5eb0a63441ce4a26b861c8aaa6eb1ac6000080be /nixos
parent34a37c5e94e87664f642e1c383e9bda5b35f8854 (diff)
downloadnixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar.gz
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar.bz2
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar.lz
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar.xz
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.tar.zst
nixpkgs-cf4c07734364e7e59414f486381360b42a9f88ea.zip
cups service: fix client sockets
Use systemd to create the directory for UNIX socket. Also use localhost instead
of 127.0.0.1 as is done in default cupsd.conf so that IPv6 is enabled when
available.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/printing/cupsd.nix7
-rw-r--r--nixos/tests/printing.nix4
2 files changed, 8 insertions, 3 deletions
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 4c7f58d1d8b..ecab8cfc7df 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -124,7 +124,7 @@ in
 
       listenAddresses = mkOption {
         type = types.listOf types.str;
-        default = [ "127.0.0.1:631" ];
+        default = [ "localhost:631" ];
         example = [ "*:631" ];
         description = ''
           A list of addresses and ports on which to listen.
@@ -321,7 +321,10 @@ in
             ''}
           '';
 
-          serviceConfig.PrivateTmp = true;
+          serviceConfig = {
+            PrivateTmp = true;
+            RuntimeDirectory = [ "cups" ];
+          };
       };
 
     systemd.services.cups-browsed = mkIf avahiEnabled
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 2d3ecaf94cf..98900883061 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -39,7 +39,9 @@ import ./make-test.nix ({pkgs, ... }: {
       $client->waitForUnit("cups.service");
       $client->sleep(10); # wait until cups is fully initialized
       $client->succeed("lpstat -r") =~ /scheduler is running/ or die;
-      $client->succeed("lpstat -H") =~ "localhost:631" or die;
+      # Test that UNIX socket is used for connections.
+      $client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
+      # Test that HTTP server is available too.
       $client->succeed("curl --fail http://localhost:631/");
       $client->succeed("curl --fail http://server:631/");
       $server->fail("curl --fail --connect-timeout 2  http://client:631/");