unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: guix-devel@gnu.org
Subject: [PATCH v2 7/7] gnu: Add polkit service.
Date: Tue, 18 Aug 2015 11:57:15 +0200	[thread overview]
Message-ID: <dfd1315880b03d2c4a119a6190b0c97ab66a55d9.1440062095.git.wingo@pobox.com> (raw)
In-Reply-To: <95cd06d0b1639449fffa2ded823e54d0f26afbb6.1440062095.git.wingo@pobox.com>

* gnu/services/desktop.scm (polkit-service): New function.
  (%desktop-services): Add polkit service.
---
 gnu/services/desktop.scm | 48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 4973e82..543b452 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -30,6 +30,7 @@
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages wicd)
+  #:use-module (gnu packages polkit)
   #:use-module (guix monads)
   #:use-module (guix store)
   #:use-module (guix gexp)
@@ -40,6 +41,7 @@
             geoclue-application
             %standard-geoclue-applications
             geoclue-service
+            polkit-service
             elogind-service
             %desktop-services))
 
@@ -376,6 +378,40 @@ site} for more information."
 
 \f
 ;;;
+;;; Polkit privilege management service.
+;;;
+
+(define* (polkit-service #:key (polkit polkit))
+  "Return a service that runs the @command{polkit} privilege management
+service.  By querying the @command{polkit} service, a privileged system
+component can know when it should grant additional capabilities to ordinary
+users.  For example, an ordinary user can be granted the capability to suspend
+the system if the user is logged in locally."
+  (with-monad %store-monad
+    (return
+     (service
+      (documentation "Run the polkit privilege management service.")
+      (provision '(polkit-daemon))
+      (requirement '(dbus-system))
+
+      (start #~(make-forkexec-constructor
+                (list (string-append #$polkit "/lib/polkit-1/polkitd"))))
+      (stop #~(make-kill-destructor))
+
+      (user-groups (list (user-group
+                          (name "polkitd")
+                          (system? #t))))
+      (user-accounts (list (user-account
+                            (name "polkitd")
+                            (group "polkitd")
+                            (system? #t)
+                            (comment "Polkit daemon user")
+                            (home-directory "/var/empty")
+                            (shell
+                             "/run/current-system/profile/sbin/nologin"))))))))
+
+\f
+;;;
 ;;; Elogind login and seat management service.
 ;;;
 
@@ -407,14 +443,16 @@ when they log out."
          (avahi-service)
          (wicd-service)
          (upower-service)
-         ;; FIXME: The colord and geoclue services could all be bus-activated
-         ;; by default, so they don't run at program startup.  However, user
-         ;; creation and /var/lib.colord creation happen at service activation
-         ;; time, so we currently add them to the set of default services.
+         ;; FIXME: The colord, geoclue, and polkit services could all be
+         ;; bus-activated by default, so they don't run at program startup.
+         ;; However, user creation and /var/lib/colord creation happen at
+         ;; service activation time, so we currently add them to the set of
+         ;; default services.
          (colord-service)
          (geoclue-service)
+         (polkit-service)
          (elogind-service)
-         (dbus-service (list avahi wicd upower colord geoclue elogind))
+         (dbus-service (list avahi wicd upower colord geoclue polkit elogind))
 
          (ntp-service)
 
-- 
2.4.3

  parent reply	other threads:[~2015-08-20  9:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  8:03 [PATCH v2 1/7] guix: git: Support shallow git clones if a tag is available Andy Wingo
2015-08-18  8:05 ` [PATCH v2 2/7] gnu: elogind: Update to version 219.5 Andy Wingo
2015-08-25 14:46   ` Ludovic Courtès
2015-08-18  8:22 ` [PATCH v2 3/7] gnu: Allow OS configurations to add PAM session modules Andy Wingo
2015-08-25 14:55   ` Ludovic Courtès
2015-08-25 16:00     ` Andy Wingo
2015-08-25 21:39       ` Ludovic Courtès
2015-08-26  7:21         ` Andy Wingo
2015-08-26  7:36           ` 宋文武
2015-08-28  9:04           ` Ludovic Courtès
2015-08-18  9:39 ` [PATCH v2 4/7] gnu: polkit: Use elogind for seat management Andy Wingo
2015-08-25 14:56   ` Ludovic Courtès
2015-08-25 16:00     ` Andy Wingo
2015-08-18  9:54 ` [PATCH v2 5/7] gnu: colord: Add libcap input Andy Wingo
2015-08-25 15:03   ` Ludovic Courtès
2015-08-25 16:01     ` Andy Wingo
2015-08-25 21:40       ` Ludovic Courtès
2015-08-18  9:56 ` [PATCH v2 6/7] gnu: Add elogind service Andy Wingo
2015-08-25 15:04   ` Ludovic Courtès
2015-08-18  9:57 ` Andy Wingo [this message]
2015-08-25 15:05   ` [PATCH v2 7/7] gnu: Add polkit service Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfd1315880b03d2c4a119a6190b0c97ab66a55d9.1440062095.git.wingo@pobox.com \
    --to=wingo@pobox.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).