[bug#34240,2/5] services: Add cups-pk-helper.

Message ID 20190129114242.32481-2-mail@cbaines.net
State Accepted
Commit 96c7b4c846214a9f04480fc1a5be37ac5c42744e
Headers show
Series Gnome printing improvements | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Christopher Baines Jan. 29, 2019, 11:42 a.m. UTC
This service integrates cups and PolicyKit. The gnome-control-center printing
section uses this functionality.

* gnu/sevices/desktop.scm (cups-pk-helper-service-type): New variable.
(%desktop-services): Add the cups-pk-helper service.
---
 gnu/services/desktop.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Ricardo Wurmus Jan. 29, 2019, 4:44 p.m. UTC | #1
Christopher Baines <mail@cbaines.net> writes:

> This service integrates cups and PolicyKit. The gnome-control-center printing
> section uses this functionality.
>
> * gnu/sevices/desktop.scm (cups-pk-helper-service-type): New variable.
> (%desktop-services): Add the cups-pk-helper service.

I wonder if this service is really needed or if it would be enough to
install the package into the system profile, for example.

(It looks fine to me, but I’m still curious.)
Christopher Baines Jan. 29, 2019, 4:56 p.m. UTC | #2
Ricardo Wurmus <rekado@elephly.net> writes:

> Christopher Baines <mail@cbaines.net> writes:
>
>> This service integrates cups and PolicyKit. The gnome-control-center printing
>> section uses this functionality.
>>
>> * gnu/sevices/desktop.scm (cups-pk-helper-service-type): New variable.
>> (%desktop-services): Add the cups-pk-helper service.
>
> I wonder if this service is really needed or if it would be enough to
> install the package into the system profile, for example.
>
> (It looks fine to me, but I’m still curious.)

Thanks for taking a look Ricardo. I'm unsure, this DBus/Polkit stuff is
still a bit of a mystery to me. These files are put in place by the
service [1], and I think that's what makes it do stuff...

1:
/etc/dbus-1/system-services/org.opensuse.CupsPkHelper.Mechanism.service
/etc/polkit-1/actions/org.opensuse.cupspkhelper.mechanism.policy

I guess it entirely depends on the configuration for DBus and Polkit in
Guix, but I can't see similar things in /run/current-system/profile/etc/
so I'm guessing it's not currently possible to make this work through
the system profile.

Patch

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index fbeabf1162..a93fa3c356 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -39,6 +39,7 @@ 
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages xfce)
@@ -801,6 +802,21 @@  accountsservice web site} for more information."
   (service accountsservice-service-type accountsservice))
 
 
+;;;
+;;; cups-pk-helper service.
+;;;
+
+(define cups-pk-helper-service-type
+  (service-type
+   (name 'cups-pk-helper)
+   (description
+    "PolicyKit helper to configure CUPS with fine-grained privileges.")
+   (extensions
+    (list (service-extension dbus-root-service-type list)
+          (service-extension polkit-service-type list)))
+   (default-value cups-pk-helper)))
+
+
 ;;;
 ;;; GNOME desktop service.
 ;;;
@@ -990,6 +1006,7 @@  as expected.")))
          (udisks-service)
          (upower-service)
          (accountsservice-service)
+         (service cups-pk-helper-service-type)
          (colord-service)
          (geoclue-service)
          (service polkit-service-type)