about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJascha Geerds <jg@ekby.de>2015-04-28 20:37:34 +0200
committerDomen Kožar <domen@dev.si>2015-05-10 12:41:20 +0200
commit4ac95ab3282a5aa364c8c1e51b9637b38729a3a7 (patch)
tree90a0e20cc5460363beda3741acfcdac6b1d09444
parent5f5ba7dda06c6fc4024f362665a650c742d55e42 (diff)
downloadnixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar.gz
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar.bz2
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar.lz
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar.xz
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.tar.zst
nixlib-4ac95ab3282a5aa364c8c1e51b9637b38729a3a7.zip
cups: Use systemd files provided by CUPS
-rw-r--r--nixos/modules/services/printing/cupsd.nix9
-rw-r--r--pkgs/misc/cups/default.nix13
2 files changed, 16 insertions, 6 deletions
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index b573a356b351..a69a8aab86a3 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -183,10 +183,10 @@ in
     # gets loaded, and then cups cannot access the printers.
     boot.blacklistedKernelModules = [ "usblp" ];
 
-    systemd.services.cups =
-      { description = "CUPS Printing Daemon";
+    systemd.packages = [ cups ];
 
-        wantedBy = [ "multi-user.target" ];
+    systemd.services.cups =
+      { wantedBy = [ "multi-user.target" ];
         wants = [ "network.target" ];
         after = [ "network.target" ];
 
@@ -200,9 +200,6 @@ in
             mkdir -m 0755 -p ${cfg.tempDir}
           '';
 
-        serviceConfig.Type = "forking";
-        serviceConfig.ExecStart = "@${cups}/sbin/cupsd cupsd";
-
         restartTriggers =
           [ config.environment.etc."cups/cups-files.conf".source
             config.environment.etc."cups/cupsd.conf".source
diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix
index 45b042960d2e..10fd71a07541 100644
--- a/pkgs/misc/cups/default.nix
+++ b/pkgs/misc/cups/default.nix
@@ -58,6 +58,19 @@ stdenv.mkDerivation {
     ''
       # Delete obsolete stuff that conflicts with cups-filters.
       rm -rf $out/share/cups/banners $out/share/cups/data/testprint
+
+      # Rename systemd files provided by CUPS
+      for f in $out/lib/systemd/system/*; do
+        substituteInPlace "$f" \
+          --replace "org.cups.cupsd" "cups" \
+          --replace "org.cups." ""
+
+        if [[ "$f" =~ .*cupsd\..* ]]; then
+          mv "$f" "''${f/org\.cups\.cupsd/cups}"
+        else
+          mv "$f" "''${f/org\.cups\./}"
+        fi
+      done
     '';
 
   meta = {