summary refs log tree commit diff
path: root/nixos/modules/services/printing/cupsd.nix
diff options
context:
space:
mode:
authortv@shackspace.de <tv@shackspace.de>2014-12-16 03:12:02 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-16 18:23:40 +0100
commitb71f3c431556d7082b2673947e492aa762d4ff3c (patch)
treec1b951d59c5f6f8cc93529c6a72d1ba2aaf96d0d /nixos/modules/services/printing/cupsd.nix
parent8bfd6af9ed0eb774035431dab663ee131941a971 (diff)
downloadnixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar.gz
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar.bz2
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar.lz
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar.xz
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.tar.zst
nixpkgs-b71f3c431556d7082b2673947e492aa762d4ff3c.zip
nixos/cupsd: use cups-files.conf
Diffstat (limited to 'nixos/modules/services/printing/cupsd.nix')
-rw-r--r--nixos/modules/services/printing/cupsd.nix46
1 files changed, 34 insertions, 12 deletions
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 22667739494..3a9524d7c37 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -90,6 +90,15 @@ in
         '';
       };
 
+      cupsFilesConf = mkOption {
+        type = types.lines;
+        default = "";
+        description = ''
+          The contents of the configuration file of the CUPS daemon
+          (<filename>cups-files.conf</filename>).
+        '';
+      };
+
       extraConf = mkOption {
         type = types.lines;
         default = "";
@@ -159,6 +168,12 @@ in
       { source = pkgs.writeText "client.conf" cfg.clientConf;
         target = "cups/client.conf";
       }
+      { source = pkgs.writeText "cups-files.conf" cfg.cupsFilesConf;
+        target = "cups/cups-files.conf";
+      }
+      { source = pkgs.writeText "cupsd.conf" cfg.cupsdConf;
+        target = "cups/cupsd.conf";
+      }
     ];
 
     services.dbus.packages = [ cups ];
@@ -177,6 +192,10 @@ in
 
         path = [ cups ];
 
+        environment = {
+          CUPS_SERVERROOT = "/etc/cups";
+        };
+
         preStart =
           ''
             mkdir -m 0755 -p /etc/cups
@@ -186,7 +205,7 @@ in
           '';
 
         serviceConfig.Type = "forking";
-        serviceConfig.ExecStart = "@${cups}/sbin/cupsd cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf}";
+        serviceConfig.ExecStart = "@${cups}/sbin/cupsd cupsd -c /etc/cups/cupsd.conf";
       };
 
     services.printing.drivers =
@@ -194,27 +213,18 @@ in
         pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
       ];
 
-    services.printing.cupsdConf =
+    services.printing.cupsFilesConf =
       ''
-        LogLevel info
-
         SystemGroup root wheel
 
-        ${concatMapStrings (addr: ''
-          Listen ${addr}
-        '') cfg.listenAddresses}
-        Listen /var/run/cups/cups.sock
-
         # Note: we can't use ${cups}/etc/cups as the ServerRoot, since
         # CUPS will write in the ServerRoot when e.g. adding new printers
         # through the web interface.
-        ServerRoot /etc/cups
+        #ServerRoot /etc/cups
 
         ServerBin ${bindir}/lib/cups
         DataDir ${bindir}/share/cups
 
-        SetEnv PATH ${bindir}/lib/cups/filter:${bindir}/bin:${bindir}/sbin
-
         AccessLog syslog
         ErrorLog syslog
         PageLog syslog
@@ -227,6 +237,18 @@ in
         # these programs to run as `lp' as well.
         User cups
         Group lp
+      '';
+
+    services.printing.cupsdConf =
+      ''
+        LogLevel info
+
+        ${concatMapStrings (addr: ''
+          Listen ${addr}
+        '') cfg.listenAddresses}
+        Listen /var/run/cups/cups.sock
+
+        SetEnv PATH ${bindir}/lib/cups/filter:${bindir}/bin:${bindir}/sbin
 
         Browsing On
         BrowseOrder allow,deny