summary refs log tree commit diff
path: root/nixos/modules/services/printing/cupsd.nix
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-09-06 13:51:38 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2019-09-06 13:51:38 -0400
commitb9d9045d5745fec640fb8261f9bdf2512eb372bd (patch)
tree2c2468fe0110eca563a8f12d963e005ff03c4e25 /nixos/modules/services/printing/cupsd.nix
parent5d4890b58dcbe0a099cda233a259284a6e5ec9d4 (diff)
downloadnixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar.gz
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar.bz2
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar.lz
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar.xz
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.tar.zst
nixpkgs-b9d9045d5745fec640fb8261f9bdf2512eb372bd.zip
nixos/cupsd: passwordless admin for wheel with polkit
Diffstat (limited to 'nixos/modules/services/printing/cupsd.nix')
-rw-r--r--nixos/modules/services/printing/cupsd.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 42c1b9482cb..f0179c1fb02 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -291,6 +291,16 @@ in
 
     services.dbus.packages = [ cups.out ] ++ optional polkitEnabled cups-pk-helper;
 
+    # Allow asswordless printer admin for members of wheel group
+    security.polkit.extraConfig = mkIf polkitEnabled ''
+      polkit.addRule(function(action, subject) {
+          if (action.id == "org.opensuse.cupspkhelper.mechanism.all-edit" &&
+              subject.isInGroup("wheel")){
+              return polkit.Result.YES;
+          }
+      });
+    '';
+
     # Cups uses libusb to talk to printers, and does not use the
     # linux kernel driver. If the driver is not in a black list, it
     # gets loaded, and then cups cannot access the printers.