about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-25 00:30:12 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-25 00:30:12 +0200
commitb8d59765e11e20ff8859c93220454a6a84445c1f (patch)
tree3765c8a81f5df1a0c2d95956c63e771d6c9bc94e /nixos
parentcd05320716c08c5da0cf6b0314d6baeb54d0730f (diff)
downloadnixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar.gz
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar.bz2
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar.lz
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar.xz
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.tar.zst
nixlib-b8d59765e11e20ff8859c93220454a6a84445c1f.zip
cups: Add a listenAddresses option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/printing/cupsd.nix13
-rw-r--r--nixos/tests/printing.nix2
2 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index edbba7e0a834..d229c610669f 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -56,6 +56,15 @@ in
         '';
       };
 
+      listenAddresses = mkOption {
+        type = types.listOf types.str;
+        default = [ "127.0.0.1:631" ];
+        example = [ "*:631" ];
+        description = ''
+          A list of addresses and ports on which to listen.
+        '';
+      };
+
       bindirCmds = mkOption {
         type = types.lines;
         internal = true;
@@ -154,7 +163,9 @@ in
 
         SystemGroup root wheel
 
-        Listen localhost:631
+        ${concatMapStrings (addr: ''
+          Listen ${addr}
+        '') cfg.listenAddresses}
         Listen /var/run/cups/cups.sock
 
         # Note: we can't use ${cups}/etc/cups as the ServerRoot, since
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 9ef28dcfcd4d..16f9812d93b5 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -7,9 +7,9 @@ import ./make-test.nix ({pkgs, ... }: {
     server =
       { config, pkgs, ... }:
       { services.printing.enable = true;
+        services.printing.listenAddresses = [ "*:631" ];
         services.printing.cupsdConf =
           ''
-            Listen server:631
             <Location />
               Order allow,deny
               Allow from all